🔨」 fix: if folder crash

This commit is contained in:
2024-07-14 15:39:28 +02:00
parent 4739d6b6f9
commit fe0285a5b2
17 changed files with 119 additions and 18 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/03 16:34:19 by adjoly #+# #+# */
/* Updated: 2024/07/03 19:07:23 by adjoly ### ########.fr */
/* Updated: 2024/07/14 15:34:16 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,17 @@
#include "parsing.h"
#include "error_msg.h"
bool check_file_name(t_list *redir)
{
while (redir)
{
if (!((t_redirection *)redir->content)->file_name)
return (true);
redir = redir->next;
}
return (false);
}
bool check_argv(t_list *token)
{
t_list *tmp;
@ -23,6 +34,8 @@ bool check_argv(t_list *token)
{
if (!((t_token *)tmp->content)->argv)
return (send_error_parsing(ERROR_NO_CMD));
if (check_file_name(((t_token *)tmp->content)->redirection))
return (send_error_parsing(ERROR_NO_FILE));
tmp = tmp->next;
}
return (false);