From 82cc816f76fceb8f122d3a713109bf4469a3ca2c Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 1 Oct 2021 00:25:35 +0200 Subject: [PATCH] Error in pointer --- src/model.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model.c b/src/model.c index 76fe898..ef7eed7 100644 --- a/src/model.c +++ b/src/model.c @@ -28,7 +28,7 @@ s_tictactoe *create_empty_tictactoe() { value->winner = NOBODY; value->content = (e_player*) malloc(sizeof(e_player) * TICTACTOE_SIZE); if ( ! value->content ) { - return value->content; + return NULL; } for ( int i=0;icontent[i] = NOBODY; @@ -115,7 +115,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 ) { e_location pos = p_uttt->history->last_move->inner_position; - if ( p_uttt->inner_tictactoes->content[pos]->winner == NOBODY ) { + if ( p_uttt->inner_tictactoes[pos]->winner == NOBODY ) { return pos; } }