From 3d7669d056ad66a20921d1885507e27f762bc179 Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Sat, 29 Jun 2024 20:10:50 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20fixed?= =?UTF-8?q?=20when=20echo=20doesn't=20have=20args=20after=20-n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/ft_echo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/builtins/ft_echo.c b/src/builtins/ft_echo.c index 184dd77..e087a2e 100644 --- a/src/builtins/ft_echo.c +++ b/src/builtins/ft_echo.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/29 19:19:57 by adjoly #+# #+# */ -/* Updated: 2024/06/29 20:04:36 by adjoly ### ########.fr */ +/* Updated: 2024/06/29 20:10:14 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,7 @@ size_t __nl_option(char **args) tmp = args; i = 0; - while ((*tmp)[0] == '-' && (*tmp)[1] == 'n') + while (*tmp && (*tmp)[0] == '-' && (*tmp)[1] == 'n') { tmp_arg = (*tmp); tmp_arg++; @@ -48,7 +48,7 @@ void ft_echo(char **args) else new_line = true; tmp += __nl_option(args); - while (*tmp) + while (*tmp && tmp) { ft_putstr_fd(*tmp, STDOUT_FILENO); tmp++;