Safeguard against NULL pointers

This commit is contained in:
Holger Vogt 2023-02-03 11:44:57 +01:00
parent 712ed8ac77
commit 33a3557910
1 changed files with 7 additions and 0 deletions

View File

@ -1030,10 +1030,17 @@ static char *get_terminal_name(char* element, char *numberstr, NGHASHPTR instanc
for (i = 0; i <= numnodes; i++)
thisline = nexttok(thisline);
subcktname = gettok(&thisline);
/*Search for the corresponding .subckt line*/
struct card_assoc* allsubs = xcard->level->subckts;
while (allsubs) {
xcardsubsline = allsubs->line->line;
/* safeguard against NULL pointers) */
if (!subcktname || !allsubs->name) {
tfree(subcktname);
return tprintf("n%s", numberstr);
}
if (cieq(subcktname, allsubs->name))
break;
allsubs = allsubs->next;