空指针导致程序出错
This commit is contained in:
parent
788c40131f
commit
1c581654f4
|
|
@ -166,16 +166,20 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) {
|
||||||
img, c := service.GetDeviceCurrentFrame(device_id)
|
img, c := service.GetDeviceCurrentFrame(device_id)
|
||||||
if c != count {
|
if c != count {
|
||||||
//将img转[]byte
|
//将img转[]byte
|
||||||
buf, _ := gocv.IMEncode(".jpg", img)
|
if img.Empty() {
|
||||||
buf1 := buf.GetBytes()
|
fmt.Println("device:%d img is empty!", device_id)
|
||||||
|
} else {
|
||||||
|
buf, _ := gocv.IMEncode(".jpg", img)
|
||||||
|
buf1 := buf.GetBytes()
|
||||||
|
|
||||||
err2 := ws.WriteMessage(websocket.BinaryMessage, buf1)
|
err2 := ws.WriteMessage(websocket.BinaryMessage, buf1)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
fmt.Println("send message to client err:", err2)
|
fmt.Println("send message to client err:", err2)
|
||||||
worker.SetRedisSetRemove(online_conn_key, con_id)
|
worker.SetRedisSetRemove(online_conn_key, con_id)
|
||||||
goto end
|
goto end
|
||||||
|
}
|
||||||
|
c = count
|
||||||
}
|
}
|
||||||
c = count
|
|
||||||
} else {
|
} else {
|
||||||
//每秒发送一次心跳检测
|
//每秒发送一次心跳检测
|
||||||
if t_count%10 == 0 {
|
if t_count%10 == 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue