diff options
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r-- | src/ft_exit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c index 4914803..b2efe2f 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -41,7 +41,7 @@ static void int ft_exit(uint8_t exit_code, t_cub *clist) { - if (clist->wlist->inited) + if (clist->walltexgood) { if (clist->tlist[0].img) mlx_destroy_image(clist->wlist->wlx, clist->tlist[0].img); @@ -55,8 +55,9 @@ int mlx_destroy_image(clist->wlist->wlx, clist->tlist[4].img); if (clist->mlist->isnlvl && clist->tlist[5].img) mlx_destroy_image(clist->wlist->wlx, clist->tlist[5].img); - mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); } + if (clist->wlist->inited) + mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); ft_free_lists(clist); ft_printf("Exiting program\n"); exit(exit_code); |