if ClientConnMsgList[i].GUID == guid && ClientConnMsgList[i].Conn != nil{
if ClientConnMsgList[i].Conn.WriteMessage(websocket.TextMessage,mc) != nil{
return false
}
return true
}
在第一个if里面报错:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x45b1b1]
goroutine 12 [running]:
controllers.SendMsgClient(0xc042cdc4f0, 0x9, 0xc0438e5680, 0x55, 0x80, 0x0)
D:/Mahjongs/go服务器/Gop/GameServer/src/controllers/chatroom.go:240 +0x156
controllers.SendMsgToClient()
D:/Mahjongs/go服务器/Gop/GameServer/src/controllers/chatroom.go:226 +0x1c0
created by controllers.init.2
D:/Mahjongs/go服务器/Gop/GameServer/src/controllers/chatroom.go:107 +0x102
问下第一个if里面报错是因为什么原因啊
有疑问加站长微信联系(非本文作者)