fix: 修复 room_options.go 中空指针检查方式错误的问题
This commit is contained in:
parent
de43f53131
commit
556d1cdc02
|
@ -34,11 +34,11 @@ func (rco *RoomControllerOptions[EntityID, RoomID, Entity, Room]) WithOwnerInher
|
||||||
rco.ownerInheritHandler = inheritHandler[0]
|
rco.ownerInheritHandler = inheritHandler[0]
|
||||||
} else if inherit {
|
} else if inherit {
|
||||||
rco.ownerInheritHandler = func(controller *RoomController[EntityID, RoomID, Entity, Room]) *EntityID {
|
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()
|
var id = e.GetId()
|
||||||
return &id
|
return &id
|
||||||
}
|
}
|
||||||
if e := controller.GetRandomEntity(); e != nil {
|
if e := controller.GetRandomEntity(); !generic.IsNil(e) {
|
||||||
var id = e.GetId()
|
var id = e.GetId()
|
||||||
return &id
|
return &id
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue