prevent crash when defect .model line is given
(no model name or no model type)
This commit is contained in:
parent
cb4b34c463
commit
6dbe585978
|
|
@ -8651,7 +8651,15 @@ static struct card *pspice_compat(struct card *oldcard)
|
||||||
char *cut_del = curr_line = cut_line = inp_remove_ws(copy(cut_line));
|
char *cut_del = curr_line = cut_line = inp_remove_ws(copy(cut_line));
|
||||||
cut_line = nexttok(cut_line); /* skip .model */
|
cut_line = nexttok(cut_line); /* skip .model */
|
||||||
modname = gettok(&cut_line); /* save model name */
|
modname = gettok(&cut_line); /* save model name */
|
||||||
|
if (!modname) {
|
||||||
|
fprintf(stderr, "Warning: No model name given for %s\n", curr_line);
|
||||||
|
controlled_exit(EXIT_BAD);
|
||||||
|
}
|
||||||
modtype = gettok_noparens(&cut_line); /* save model type */
|
modtype = gettok_noparens(&cut_line); /* save model type */
|
||||||
|
if (!modtype) {
|
||||||
|
fprintf(stderr, "Warning: No model type given for %s\n", curr_line);
|
||||||
|
controlled_exit(EXIT_BAD);
|
||||||
|
}
|
||||||
if (cieq(modtype, "NMOS") || cieq(modtype, "PMOS")) {
|
if (cieq(modtype, "NMOS") || cieq(modtype, "PMOS")) {
|
||||||
char* lv = strstr(cut_line, "level=");
|
char* lv = strstr(cut_line, "level=");
|
||||||
if (lv) {
|
if (lv) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue