From 0ff026b4ca89ba6eca032b0ad8abe9cd8cce0831 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 7 Oct 2021 22:02:12 +0200 Subject: [PATCH] Avoid segfault when testing p_uttt->history in get_next_outter_position() --- src/model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model.c b/src/model.c index 996a17a..9511665 100644 --- a/src/model.c +++ b/src/model.c @@ -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;