fix: 修复 room_options.go 中空指针检查方式错误的问题

This commit is contained in:
kercylan98 2023-12-25 19:16:10 +08:00
parent de43f53131
commit 556d1cdc02
1 changed files with 2 additions and 2 deletions

View File

@ -34,11 +34,11 @@ func (rco *RoomControllerOptions[EntityID, RoomID, Entity, Room]) WithOwnerInher
rco.ownerInheritHandler = inheritHandler[0]
} else if inherit {
rco.ownerInheritHandler = func(controller *RoomController[EntityID, RoomID, Entity, Room]) *EntityID {
if e := controller.GetFirstEmptySeatEntity(); e != nil {
if e := controller.GetFirstEmptySeatEntity(); !generic.IsNil(e) {
var id = e.GetId()
return &id
}
if e := controller.GetRandomEntity(); e != nil {
if e := controller.GetRandomEntity(); !generic.IsNil(e) {
var id = e.GetId()
return &id
}