aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-02-29 00:29:17 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-02-29 00:29:17 +0100
commit4fccd597e3c5c97144e4324c1371db9f7f039967 (patch)
tree25cb40e9a022ca66fa038864b771e6b0fb15fc05 /src/ft_exit.c
parentAll works but one thing is not ok (diff)
download42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.gz
42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.bz2
42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.xz
42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.zst
42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.zip
Works fine, preparing small map
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 6457191..4914803 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -43,12 +43,17 @@ int
{
if (clist->wlist->inited)
{
- mlx_destroy_image(clist->wlist->wlx, clist->tlist[0].img);
- mlx_destroy_image(clist->wlist->wlx, clist->tlist[1].img);
- mlx_destroy_image(clist->wlist->wlx, clist->tlist[2].img);
- mlx_destroy_image(clist->wlist->wlx, clist->tlist[3].img);
- mlx_destroy_image(clist->wlist->wlx, clist->tlist[4].img);
- if (clist->mlist->isnlvl)
+ if (clist->tlist[0].img)
+ mlx_destroy_image(clist->wlist->wlx, clist->tlist[0].img);
+ if (clist->tlist[1].img)
+ mlx_destroy_image(clist->wlist->wlx, clist->tlist[1].img);
+ if (clist->tlist[2].img)
+ mlx_destroy_image(clist->wlist->wlx, clist->tlist[2].img);
+ if (clist->tlist[3].img)
+ mlx_destroy_image(clist->wlist->wlx, clist->tlist[3].img);
+ if (clist->tlist[4].img)
+ 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);
}