fix: 修复 room 包中通过 Manager 获取 Helper 时,当传入的 room 为空依旧会返回不为空指针的 Helper 问题

This commit is contained in:
kercylan98 2023-08-01 11:03:43 +08:00
parent 9198faa061
commit e8c2cf2835
1 changed files with 3 additions and 0 deletions

View File

@ -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