aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-21 22:06:14 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-21 22:06:14 +0100
commitd669957a4917d5928ca1a10d635409891ec19ed0 (patch)
treed405206f4d9f9d97280be3c97d814535cea44499 /src/ft_exit.c
parentfixed most valgrind bullshit (diff)
download42-cub3d-d669957a4917d5928ca1a10d635409891ec19ed0.tar.gz
42-cub3d-d669957a4917d5928ca1a10d635409891ec19ed0.tar.bz2
42-cub3d-d669957a4917d5928ca1a10d635409891ec19ed0.tar.xz
42-cub3d-d669957a4917d5928ca1a10d635409891ec19ed0.tar.zst
42-cub3d-d669957a4917d5928ca1a10d635409891ec19ed0.zip
Few fixes
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 4c89bc6..8bf79ce 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -29,21 +29,24 @@ static void
ft_memdel((void*)&clist->sprites[i]);
i++;
}
- i = 0;
- while (i < 4)
- {
- if (clist->tweap[i].img)
- mlx_destroy_image(clist->wlist.wlx, clist->tweap[i].img);
- i++;
- }
- i = 0;
- while (i < 2)
+ ft_memdel((void*)&clist->sprites);
+ if (clist->wlist.inited)
{
- if (clist->tlist[i + 18].img)
- mlx_destroy_image(clist->wlist.wlx, clist->tlist[i + 18].img);
- i++;
+ i = 0;
+ while (i < 4)
+ {
+ if (clist->tweap[i].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tweap[i].img);
+ i++;
+ }
+ i = 0;
+ while (i < 2)
+ {
+ if (clist->tlist[i + 18].img)
+ mlx_destroy_image(clist->wlist.wlx, clist->tlist[i + 18].img);
+ i++;
+ }
}
- ft_memdel((void*)&clist->sprites);
if (!clist->wlist.inited)
{
ft_memdel((void*)&clist->wlist.winptr);