fixed NULL check from getNextEntry
This commit is contained in:
@ -1221,7 +1221,17 @@ ListOfTable *getRestOfChildren(ListOfTable *lt) { return lt->next; }
|
|||||||
TableNode *getFirstEntry(SymbolTable *st) { return st->entries; }
|
TableNode *getFirstEntry(SymbolTable *st) { return st->entries; }
|
||||||
|
|
||||||
// Segfaults when passed an invalid table node!
|
// Segfaults when passed an invalid table node!
|
||||||
TableNode *getNextEntry(TableNode *tn) { return tn; }
|
TableNode *getNextEntry(TableNode *tn) {
|
||||||
|
if (tn == NULL) {
|
||||||
|
printdebug("passed a NULL table node to getNextEntry");
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (tn == undefined) {
|
||||||
|
printdebug("passed an undefined table node to getNextEntry");
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return tn->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// uncomment the below main function along with the headers above for a simple
|
// uncomment the below main function along with the headers above for a simple
|
||||||
|
Reference in New Issue
Block a user