Check dictionaries before key deletion
This commit is contained in:
parent
b5fd5947ff
commit
b0f9df9029
@ -138,8 +138,12 @@ func (m *Match) MatchLeave(ctx context.Context, logger runtime.Logger, db *sql.D
|
|||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
for _, presence := range presences {
|
for _, presence := range presences {
|
||||||
delete(mState.presences, presence.GetUserId())
|
if _, ok := mState.presences[presence.GetUserId()]; ok {
|
||||||
delete(mState.players, presence.GetUserId())
|
delete(mState.presences, presence.GetUserId())
|
||||||
|
}
|
||||||
|
if _, ok := mState.players[presence.GetUserId()]; ok {
|
||||||
|
delete(mState.players, presence.GetUserId())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return mState
|
return mState
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user