fix: empty line is now not add to the history

This commit is contained in:
Camille Chauvet 2023-02-23 15:21:06 +01:00
parent 405c1937cd
commit 7728ded62d

3
main.c
View File

@ -31,7 +31,8 @@ static char *ft_get_user_input(t_list **env)
return (NULL);
}
line = readline(prompt);
add_history(line);
if (line != NULL && ft_strcmp(line, "") != 0)
add_history(line);
free(prompt);
return (line);
}