summaryrefslogtreecommitdiffstats
path: root/src/ft_s_lcom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_s_lcom.c')
-rw-r--r--src/ft_s_lcom.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c
index 33ad5da..03b2f67 100644
--- a/src/ft_s_lcom.c
+++ b/src/ft_s_lcom.c
@@ -27,10 +27,15 @@ static int8_t
uint64_t j;
i = 0;
- if (!((*lcom)->com = (char*)malloc((ft_strlen(words[0]) + 1) *
- sizeof(char))))
- return (-1);
- ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1);
+ if (words[0])
+ {
+ if (!((*lcom)->com = (char*)malloc((ft_strlen(words[0]) + 1) *
+ sizeof(char))))
+ return (-1);
+ ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1);
+ }
+ else
+ return (0);
while(words[i])
{
/* TODO: cut fd number "msh ~> echo a 2>file" */