lstadd reconnais une liste non initiee

This commit is contained in:
Hugo LAMY
2019-11-28 16:43:55 +01:00
parent 07a2d393ef
commit ff5e4c9645
2 changed files with 8 additions and 6 deletions

View File

@@ -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);
}

View File

@@ -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);
}