lstadd reconnais une liste non initiee
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 14:14:49 by hulamy #+# #+# */
|
||||
/* Updated: 2019/11/25 14:30:20 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/11/28 16:43:18 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -93,7 +93,8 @@
|
||||
|
||||
t_list *ft_lstlast(t_list *lst)
|
||||
{
|
||||
while (lst->next)
|
||||
lst = lst->next;
|
||||
if (lst)
|
||||
while (lst->next)
|
||||
lst = lst->next;
|
||||
return (lst);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 14:14:49 by hulamy #+# #+# */
|
||||
/* Updated: 2019/11/25 14:30:20 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/11/28 16:42:21 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -93,7 +93,8 @@
|
||||
|
||||
t_list *ft_lstlast(t_list *lst)
|
||||
{
|
||||
while (lst->next)
|
||||
lst = lst->next;
|
||||
if (lst)
|
||||
while (lst->next)
|
||||
lst = lst->next;
|
||||
return (lst);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user