Fix uninitialized value when board has no King

It's possible for there to be no King if we're running unit tests rather
than a real game.
This commit is contained in:
Michael Catanzaro 2024-07-08 08:38:52 -05:00
parent 50c3ae576b
commit be01a9349d

View file

@ -624,10 +624,15 @@ public class ChessState : Object
rank = ranks;
file = files;
return found;
}
}
return found;
/* There is no King. (Must be a test rather than a real game!) */
rank = {};
file = {};
return false;
}
public bool is_in_check (ChessPlayer player)