Prevent crash upon buggy user input
This commit is contained in:
parent
442d8554f0
commit
28d8301b5f
|
|
@ -753,7 +753,7 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Internal error: bad node type %d\n", p->type);
|
||||
fprintf(stderr, "Error: bad node type %d\n", p->type);
|
||||
newp = NULL;
|
||||
break;
|
||||
}
|
||||
|
|
@ -778,6 +778,10 @@ static INPparseNode *mkb(int type, INPparseNode * left,
|
|||
INPparseNode *p;
|
||||
int i;
|
||||
|
||||
if (!right || !left) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((right->type == PT_CONSTANT) && (left->type == PT_CONSTANT)) {
|
||||
double value;
|
||||
switch (type) {
|
||||
|
|
@ -890,6 +894,9 @@ static INPparseNode *mkf(int type, INPparseNode * arg)
|
|||
INPparseNode *p;
|
||||
int i;
|
||||
|
||||
if (!arg)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < NUM_FUNCS; i++)
|
||||
if (funcs[i].number == type)
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue