Prevent a crash if p==NULL (due to buggy input)

This commit is contained in:
Holger Vogt 2023-07-04 11:45:27 +02:00
parent 794a37339a
commit ba2842b55a
1 changed files with 9 additions and 1 deletions

View File

@ -1167,12 +1167,20 @@ INPparseNode *PT_mkfnode(const char *fname, INPparseNode * arg)
p->function = funcs[i].funcptr;
p->data = NULL;
if(p->funcnum == PTF_PWL)
if (p->funcnum == PTF_PWL) {
p = prepare_PTF_PWL(p);
if (p == NULL) {
fprintf(stderr, "Error while parsing function '%s'\n", buf);
if (ft_stricterror)
controlled_exit(EXIT_BAD);
return mkfirst(NULL, arg);
}
}
if (p->funcnum == PTF_DDT)
p = prepare_PTF_DDT(p);
return (p);
}