lsterase correction oublis verif existence list avant et apres
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/03/24 15:31:16 by simplonco #+# #+# */
|
/* Created: 2022/03/24 15:31:16 by simplonco #+# #+# */
|
||||||
/* Updated: 2022/03/24 15:40:32 by simplonco ### ########.fr */
|
/* Updated: 2022/03/24 20:54:20 by simplonco ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -22,7 +22,9 @@ void ft_lsterase(t_list *lst, void (*del)(void *))
|
|||||||
if (!lst || !del)
|
if (!lst || !del)
|
||||||
return ;
|
return ;
|
||||||
del(lst->content);
|
del(lst->content);
|
||||||
|
if (lst->prev)
|
||||||
lst->prev->next = lst->next;
|
lst->prev->next = lst->next;
|
||||||
|
if (lst->next)
|
||||||
lst->next->prev = lst->prev;
|
lst->next->prev = lst->prev;
|
||||||
free(lst);
|
free(lst);
|
||||||
lst = NULL;
|
lst = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user