Fix fields always ending with empty string
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 1 Aug 2024 10:07:42 +0000 (12:07 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 1 Aug 2024 10:07:42 +0000 (12:07 +0200)
src/execution.c

index 1fa030233495c16b7c900f8a7c9d4c072b19d44d..bf4d325cf493784aad4c59d8253d9c05e69340ff 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/07/21 08:57:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/01 11:48:48 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/01 12:07:31 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -524,6 +524,8 @@ char        **quoted_split(const char *str)
                while (str[i] == ' ')
                        ++i;
                n = get_next_word_size(str + i);
+               if (n == 0)
+                       break ;
                new_str = ft_strndup(str + i, n);
                if (!new_str)
                {