fix(sprite caster): Added a check for empty list of sprites to avoid SEGFAULTing

This commit is contained in:
Theo Champion 2025-08-08 11:56:45 +02:00
parent c796d44b56
commit a0967d5f93

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/05 15:51:01 by tchampio #+# #+# */
/* Updated: 2025/08/07 13:28:07 by tchampio ### ########.fr */
/* Updated: 2025/08/07 16:57:29 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -106,6 +106,8 @@ void sprite_caster(t_cub3d_data *data)
{
int i;
if (!data->sprite_list)
return ;
sort_sprites(data->sprite_order, data->sprite_distances, data);
i = 0;
while (data->sprite_list[i] && i < MAX_SPRITES)