diff --git a/third_party/tcp/tcp_client.go b/third_party/tcp/tcp_client.go index 2402db1..55a92d9 100644 --- a/third_party/tcp/tcp_client.go +++ b/third_party/tcp/tcp_client.go @@ -58,7 +58,8 @@ func (c *TcpClient) Close() { } } func (c *TcpClient) Send(data []byte) error { - if c.conn == nil { + + if c == nil || c.conn == nil { slog.Error("tcp client send error,conn is nil") return fmt.Errorf("TCP未连接车载PC仿真") }