diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index 44dc93989..9d902dc81 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/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) {