Browse Source

Prevent a crash if hash model table was not generated,

e.g. due to missing valid models.
pre-master-46
Holger Vogt 2 years ago
parent
commit
efdf332061
  1. 40
      src/spicelib/parser/inpgmod.c

40
src/spicelib/parser/inpgmod.c

@ -343,31 +343,33 @@ INPgetMod(CKTcircuit *ckt, char *name, INPmodel **model, INPtables *tab)
printf("In INPgetMod, examining model %s ...\n", name);
#endif
modtmp = nghash_find(modtabhash, name);
if (modtmp) {
/* found the model in question - now instantiate if necessary */
/* and return an appropriate pointer to it */
if (modtabhash) {
modtmp = nghash_find(modtabhash, name);
if (modtmp) {
/* found the model in question - now instantiate if necessary */
/* and return an appropriate pointer to it */
/* if illegal device type */
if (modtmp->INPmodType < 0) {
/* if illegal device type */
if (modtmp->INPmodType < 0) {
#ifdef TRACE
printf("In INPgetMod, illegal device type for model %s ...\n", name);
printf("In INPgetMod, illegal device type for model %s ...\n", name);
#endif
* model = NULL;
return tprintf("Unknown device type for model %s\n", name);
}
* model = NULL;
return tprintf("Unknown device type for model %s\n", name);
}
/* create unless model is already defined */
if (!modtmp->INPmodfast) {
int error = create_model(ckt, modtmp, tab);
if (error) {
*model = NULL;
return INPerror(error);
/* create unless model is already defined */
if (!modtmp->INPmodfast) {
int error = create_model(ckt, modtmp, tab);
if (error) {
*model = NULL;
return INPerror(error);
}
}
}
*model = modtmp;
return NULL;
*model = modtmp;
return NULL;
}
}
#if (0)
for (modtmp = modtab; modtmp; modtmp = modtmp->INPnextModel) {

Loading…
Cancel
Save