From cff05e83256a67b8cb23b16b1e1e6f761ff52f4c Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 11 Jan 2020 12:37:34 +0100 Subject: fixing a few segfault, map border checking --- state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'state.c') diff --git a/state.c b/state.c index 139904b..d718493 100644 --- a/state.c +++ b/state.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/19 16:39:57 by cacharle #+# #+# */ -/* Updated: 2020/01/11 10:24:53 by cacharle ### ########.fr */ +/* Updated: 2020/01/11 12:32:13 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -106,7 +106,8 @@ void *state_destroy(t_state *state) while (++i < TEXTURES_NUM) { free(state->textures_path[i]); - mlx_destroy_image(state->mlx_ptr, state->textures[i].id); + if (state->mlx_ptr != NULL&& state->textures[i].id != NULL) + mlx_destroy_image(state->mlx_ptr, state->textures[i].id); } if (state->mlx_ptr && state->window_ptr) mlx_destroy_window(state->mlx_ptr, state->window_ptr); -- cgit