fix: 修复 room 包中通过 Manager 获取 Helper 时,当传入的 room 为空依旧会返回不为空指针的 Helper 问题
This commit is contained in:
parent
9198faa061
commit
e8c2cf2835
|
@ -32,6 +32,9 @@ type Manager[PID comparable, P game.Player[PID], R Room] struct {
|
||||||
|
|
||||||
// GetHelper 获取房间助手
|
// GetHelper 获取房间助手
|
||||||
func (slf *Manager[PID, P, R]) GetHelper(room R) *Helper[PID, P, R] {
|
func (slf *Manager[PID, P, R]) GetHelper(room R) *Helper[PID, P, R] {
|
||||||
|
if generic.IsNil(room) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
helper, exist := slf.helpers.GetExist(room.GetGuid())
|
helper, exist := slf.helpers.GetExist(room.GetGuid())
|
||||||
if exist {
|
if exist {
|
||||||
return helper
|
return helper
|
||||||
|
|
Loading…
Reference in New Issue