diff --git a/lexer_2.c b/lexer_2.c index 6cd0eb0..7d30612 100644 --- a/lexer_2.c +++ b/lexer_2.c @@ -6,7 +6,7 @@ /* By: mea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/16 07:53:17 by narnaud #+# #+# */ -/* Updated: 2022/05/17 15:41:41 by mea ### ########.fr */ +/* Updated: 2022/05/18 14:44:03 by narnaud@stude ### ########.fr */ /* */ /* ************************************************************************** */ @@ -73,7 +73,13 @@ char *get_var_value(t_datas *datas, char *line, int name_len) { env = ft_split(datas->envp[i], '='); if (!ft_strncmp(name, env[0], name_len + 1)) - value = (free(env[0]), env[1]); + { + if (env[1]) + value = env[1]; + else + value = ft_strdup(""); + free(env[0]); + } else if (++i) ft_free_split(env); }