aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-01-28 16:01:25 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-01-28 16:01:25 +0100
commit1b3cf4e3ce43e556ef47c669511620815b747221 (patch)
treebe53e93d6fd39578ce71e82502c1289aac98e819 /src/ft_exit.c
parentEverything is terrible but this might work (diff)
download42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.gz
42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.bz2
42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.xz
42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.zst
42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.zip
I understood
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 010c0d1..a3ec72d 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -12,8 +12,9 @@ ft_free_lists(t_cub *clist)
ft_memdel(clist->ea_tex_path);
ft_memdel(clist->we_tex_path);
ft_memdel(clist->sprite_path);
- ft_free_words(clist->map, NULL);
- /* ft_memdel(clist->wlist->winptr); */
+ ft_free_words(clist->map);
+ if (!clist->wlist->inited)
+ ft_memdel(clist->wlist->winptr);
ft_memdel(clist->wlist->wlx);
ft_memdel(clist->wlist);
ft_memdel(clist);
@@ -22,7 +23,8 @@ ft_free_lists(t_cub *clist)
int
ft_exit(uint8_t exit_code, t_cub *clist)
{
- mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr);
+ if (clist->wlist->inited)
+ mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr);
ft_printf("Exiting program\n");
if (exit_code < 0 || exit_code > 0)
ft_printf("Exit code: %hhu\n", exit_code);