From 650488e1c7a7585c71b07fad42cc4e402c755046 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Wed, 12 Jun 2024 14:26:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=B0=83=E6=95=B4=E5=8F=8A?= =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/semi_physical_train/semi_physical_train.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/third_party/semi_physical_train/semi_physical_train.go b/third_party/semi_physical_train/semi_physical_train.go index 144ceba..a3a3d04 100644 --- a/third_party/semi_physical_train/semi_physical_train.go +++ b/third_party/semi_physical_train/semi_physical_train.go @@ -94,9 +94,12 @@ func (s *semiPhysicalTrainImpl) Stop() { } func (s *semiPhysicalTrainImpl) SendTrainControlMessage(info *message.DynamicsTrainInfo) { - sendMsg := &message.TrainSpeedMsg{} - sendMsg.DynamicsDecode(info) - s.trainSpeedInfoUdpClient.Send(sendMsg.Encode()) + if s.trainSpeedInfoUdpClient != nil { + sendMsg := &message.TrainSpeedMsg{} + sendMsg.DynamicsDecode(info) + s.trainSpeedInfoUdpClient.Send(sendMsg.Encode()) + } + } func (s *semiPhysicalTrainImpl) initSemiPhysical() {