From 4dddd1422bc00f40be43050f53cd7525f9a73341 Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Mon, 31 Jul 2023 12:05:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B3=9B=E5=9E=8B?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=20player=20=E4=B8=8D=E8=83=BD=E5=88=A4?= =?UTF-8?q?=E6=96=AD=20nil=20=E7=9A=84=E8=A1=A8=E8=BE=BE=E5=BC=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/room/seat.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/game/room/seat.go b/game/room/seat.go index 0a3a78c..5878991 100644 --- a/game/room/seat.go +++ b/game/room/seat.go @@ -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 {