Browse Source

fix: nil bug

lijian 2 years ago
parent
commit
19d00fa2ec
1 changed files with 3 additions and 0 deletions
  1. 3 0
      pkg/mqtt/connection.go

+ 3 - 0
pkg/mqtt/connection.go

@@ -306,6 +306,9 @@ func (c *Connection) RcvMsgFromClient() {
 }
 }
 
 
 func (c *Connection) SendMsgToClient() {
 func (c *Connection) SendMsgToClient() {
+	if c.Conn == nil {
+		return
+	}
 	host := c.Conn.RemoteAddr()
 	host := c.Conn.RemoteAddr()
 	for {
 	for {
 		select {
 		select {