don't allow commands to be played in nil games

This commit is contained in:
stryan 2021-09-29 15:44:01 -04:00
parent a4227c9728
commit 2073b4d1f0

View File

@ -98,6 +98,13 @@ func (c *Coordinator) Coordinate(cmd *SessionCommand) *SessionCommandResult {
Result: SessionRespLeft,
}
}
if m.Game == nil {
return &SessionCommandResult{
ID: cmd.ID,
MatchID: m.ID,
Result: SessionRespError,
}
}
resp := m.Play(cmd.ID, cmd.GameCommand)
return &SessionCommandResult{
ID: cmd.ID,