From 03d3e2ea129b17e6af48d3a79af7e9b3341aaf19 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 11 Mar 2017 18:21:33 +0100 Subject: [PATCH] inp2q.c, #16/23, emit a message and give up, if we couldn't find the modelname token Thats a functional change of ngspice. So far we did cook up a "default" model when we didn't find a model token. But this was buggy anyway, because in such cases we silently dropped a token from beeing processed by PARSECALL() Now, we emit a message, and skip this line alltogether. --- src/spicelib/parser/inp2q.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/spicelib/parser/inp2q.c b/src/spicelib/parser/inp2q.c index e09be73f0..97d19454b 100644 --- a/src/spicelib/parser/inp2q.c +++ b/src/spicelib/parser/inp2q.c @@ -69,6 +69,8 @@ void INP2Q(CKTcircuit *ckt, INPtables * tab, card * current, CKTnode *gnode) INPtermInsert(ckt, &nname[i], tab, &node[i]); } + model = NULL; + i = 3; INPgetTok(&line, &nname[i], 1); @@ -91,13 +93,20 @@ void INP2Q(CKTcircuit *ckt, INPtables * tab, card * current, CKTnode *gnode) INPtermInsert(ckt, &nname[i], tab, &node[i]); i = 5; INPgetTok(&line, &nname[i], 1); - model = nname[i]; - INPinsert(&model, tab); - current->error = INPgetMod(ckt, model, &thismodel, tab); + if (INPlookMod(nname[i])) { + model = nname[i]; + INPinsert(&model, tab); + current->error = INPgetMod(ckt, model, &thismodel, tab); + } #endif } } + if (!model) { + LITERR ("could not find a valid modelname"); + return; + } + if (i == 3) { /* 3-terminal device - substrate to ground */ node[3] = gnode;