]> git.dkaiser.de - 42/push_swap.git/commitdiff
Fix input handling
authorDominik Kaiser <dkaiser@2-E-4.42heilbronn.de>
Sat, 13 Apr 2024 12:59:17 +0000 (14:59 +0200)
committerDominik Kaiser <dkaiser@2-E-4.42heilbronn.de>
Sat, 13 Apr 2024 12:59:17 +0000 (14:59 +0200)
Before the fix, the last element was ignored while checking for
duplicates. Now all elements are checked and input handling should
be working fine.

input_handling.c

index 93e37f6049f10d04cd51a7dcfab07bbbfc1f4caf..76996719dba43e760c4fcae7791761fe06b6301c 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/04/12 17:31:49 by dkaiser           #+#    #+#             */
-/*   Updated: 2024/04/12 18:49:38 by dkaiser          ###   ########.fr       */
+/*   Updated: 2024/04/13 14:58:42 by dkaiser          ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -43,7 +43,7 @@ static int    are_numbers_unique(t_list *stack)
        while (stack->next)
        {
                cmp_elem = stack->next;
-               while (cmp_elem->next)
+               while (cmp_elem)
                {
                        if (*(int *)stack->content == *(int *)cmp_elem->content)
                                return (0);