Added code to avoid a segfault if a resistor or capacitor is

specified without a list of substrate connection types, but
the "s=" parameter is used, resulting in an attempt to access a
substrate node that does not exist.
This commit is contained in:
R. Timothy Edwards 2025-10-06 14:14:05 -04:00
parent d6d8620a7c
commit 5e74ecf9fa
1 changed files with 7 additions and 3 deletions

View File

@ -343,9 +343,13 @@ spcHierWriteParams(
break; break;
case 's': case 's':
fprintf(esSpiceF, " %s=", plist->parm_name); fprintf(esSpiceF, " %s=", plist->parm_name);
/*EFNode *subnodeFlat =*/ spcdevSubstrate(hc->hc_hierName, if (dev->dev_subsnode == NULL)
dev->dev_subsnode->efnode_name->efnn_hier, TxError("Error: Device %s missing substrate node!\n",
dev->dev_type, esSpiceF); EFDevTypes[dev->dev_type]);
else
spcdevSubstrate(hc->hc_hierName,
dev->dev_subsnode->efnode_name->efnn_hier,
dev->dev_type, esSpiceF);
break; break;
case 'x': case 'x':
fprintf(esSpiceF, " %s=", plist->parm_name); fprintf(esSpiceF, " %s=", plist->parm_name);