diff --git a/src/model.c b/src/model.c index f0020bd..afd9554 100644 --- a/src/model.c +++ b/src/model.c @@ -107,11 +107,12 @@ void free_utictactoe(s_utictactoe *p_uttt){ } e_player get_next_player_to_play(s_utictactoe *p_uttt) { + if ( p_uttt->outer_tictactoe->winner != NOBODY ) { return NOBODY; - } + } - if ( p_uttt->history->last_move->player == PLAYER_O || + if ( (p_uttt->history->last_move && p_uttt->history->last_move->player == PLAYER_O) || p_uttt->history->last_move == NULL ) { return PLAYER_X; }