瀏覽代碼

fix send conn nil issue

dujunchen 13 小時之前
父節點
當前提交
4760ead404
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      internal/app/stc/sendstatus/status.go

+ 7 - 2
internal/app/stc/sendstatus/status.go

@@ -75,8 +75,13 @@ func AlarmStatus(exten string, status string) {
 	//check if actived
 	lfshook.NewLogger().Logger.Infof("===AlarmStatus=ext:%s===carr:%x==========pos:%x=========status:%x", exten, protocol.Data[0], protocol.Data[1], protocol.Data[2])
 	if active.Actived {
-		SendToStc(socket.Conn, encoded)
-		SendToStc(socket.Conn8, encoded)
+		if socket.Conn != nil {
+			SendToStc(socket.Conn, encoded)
+		}
+
+		if socket.Conn8 != nil {
+			SendToStc(socket.Conn8, encoded)
+		}
 	}
 }