mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
fix: segfault & leak with missing sprite image
This commit is contained in:
parent
5c7cc77419
commit
c4dc4b573a
1 changed files with 5 additions and 3 deletions
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* destroy_utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/11 12:04:26 by tchampio #+# #+# */
|
||||
/* Updated: 2025/08/12 15:39:30 by tchampio ### ########.fr */
|
||||
/* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/18 13:05:31 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -35,6 +35,8 @@ void destroy_sprites(t_cub3d_data *data)
|
|||
int sprite;
|
||||
|
||||
sprite = 0;
|
||||
if (data->sprite_list == NULL)
|
||||
return ;
|
||||
while (data->sprite_list[sprite] && sprite < MAX_SPRITES)
|
||||
{
|
||||
mlx_destroy_image(data->mlx, data->sprite_list[sprite]->image->img);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue