From b2fccde1a26bb4cfbf745fd01f76a369c20e1c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophyl=20Hoguet?= Date: Wed, 5 Jan 2022 23:46:07 +0100 Subject: [PATCH] problem on hist delete entire hist solved --- game.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/game.c b/game.c index 5a52536..3cf2c88 100644 --- a/game.c +++ b/game.c @@ -77,18 +77,14 @@ bool game_equal(cgame g1, cgame g2) { void game_delete(game g) { for (int i = 0; i < g->height; i++) { free(g->tab_cell[i]); - if (g->tab_cell[i] != NULL) - g->tab_cell[i] = NULL; + g->tab_cell[i] = NULL; } free(g->tab_cell); - if (g->tab_cell != NULL) - g->tab_cell = NULL; + g->tab_cell = NULL; history_delete_entire_history(g->hist); - if (g->hist != NULL) - g->hist = NULL; + g->hist = NULL; free(g); - if (g != NULL) - g = NULL; + g = NULL; return; } @@ -274,4 +270,5 @@ void game_restart(game g) { } game_update_flags(g); history_delete_entire_history(g->hist); + g->hist = NULL; }