The zeroth rule contains a token which has NULL at type. Because the
function cmp_token_type is used when comparing rules (items) it has to
be able to handle this NULL.
int cmp_token_type(const t_token *token1, const t_token *token2)
{
- if (!token1 && !token2)
+ if ((!token1 && !token2))
return(0);
else if (!token1 || !token2)
return(1);
+ if ((!token1->type && !token2->type))
+ return(0);
+ else if (!token1->type || !token2->type)
+ return(1);
return (ft_strcmp(token1->type, token2->type));
}