fix: 修复泛型对象 player 不能判断 nil 的表达式错误

This commit is contained in:
kercylan98 2023-07-31 12:05:42 +08:00
parent 0fad0417c7
commit 4dddd1422b
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package room
import (
"github.com/kercylan98/minotaur/game"
"github.com/kercylan98/minotaur/utils/concurrent"
"github.com/kercylan98/minotaur/utils/generic"
"github.com/kercylan98/minotaur/utils/hash"
"sync"
)
@ -91,7 +92,7 @@ func (slf *Seat[PlayerID, P, R]) SetSeat(id PlayerID, seat int) int {
}()
oldSeat := slf.GetSeat(id)
player := slf.GetPlayerWithSeat(seat)
if player != nil {
if generic.IsNil(player) {
if oldSeat == NoSeat {
maxSeat := len(slf.seatSP) - 1
if seat > maxSeat {