1 file changed, +2, -4
8730c57refactor: lstlast
ft_lstlast.c
+2, -4
+2, -4
@@ -6,7 +6,7 @@
6 6 /* By: mleitao <mleitao@student.42.fr> +#+ +:+ +#+ */
7 7 /* +#+#+#+#+#+ +#+ */
8 8 /* Created: 2026/03/16 18:21:34 by mleitao #+# #+# */
9 -/* Updated: 2026/03/16 18:51:50 by mleitao ### ########.fr */
9+/* Updated: 2026/03/17 16:25:46 by mleitao ### ########.fr */
1010 /* */
1111 /* ************************************************************************** */
1212
@@ -14,9 +14,7 @@
1414
1515 t_list *ft_lstlast(t_list *lst)
1616 {
17 - if (!lst)
18 - return (NULL);
19 - while (lst->next)
17+ while (lst && lst->next)
2018 lst = lst->next;
2119 return (lst);
2220 }