fix: 修复 room.Manager.GetRoom 函数的空指针问题
This commit is contained in:
parent
fb60065ec1
commit
039500ba87
|
@ -208,8 +208,11 @@ func (slf *Manager[PID, P, R]) SetOwner(roomId int64, owner PID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRoom 获取房间
|
// GetRoom 获取房间
|
||||||
func (slf *Manager[PID, P, R]) GetRoom(guid int64) R {
|
func (slf *Manager[PID, P, R]) GetRoom(guid int64) (r R) {
|
||||||
return slf.rooms.Get(guid).room
|
if room := slf.rooms.Get(guid); room != nil {
|
||||||
|
r = room.room
|
||||||
|
}
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exist 检查房间是否存在
|
// Exist 检查房间是否存在
|
||||||
|
|
Loading…
Reference in New Issue