ft_lstlast: fix segfault when lst=NULL

This commit is contained in:
Khaïs COLIN 2024-10-21 13:31:45 +02:00
parent d9097ecd53
commit 4709b5929a

View file

@ -6,7 +6,7 @@
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/21 12:03:16 by kcolin #+# #+# */
/* Updated: 2024/10/21 12:04:50 by kcolin ### ########.fr */
/* Updated: 2024/10/21 13:16:06 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,6 +16,8 @@ t_list *ft_lstlast(t_list *lst)
{
t_list *current;
if (lst == NULL)
return (NULL);
current = lst;
while (current->next != NULL)
{