Avoid segfault when testing p_uttt->history

in get_next_outter_position()
This commit is contained in:
Yorick Barbanneau 2021-10-07 22:02:12 +02:00
parent f319f0e53c
commit 0ff026b4ca

View file

@ -124,7 +124,7 @@ e_player get_next_player_to_play(s_utictactoe *p_uttt) {
}
e_location get_next_outer_position(s_utictactoe *p_uttt) {
if ( p_uttt->inner_tictactoes != NULL ) {
if ( p_uttt->inner_tictactoes != NULL && p_uttt->history != NULL) {
e_location pos = p_uttt->history->last_move->inner_position;
if ( p_uttt->inner_tictactoes[pos]->winner == NOBODY ) {
return pos;