From 972785095f788bcd797047d6c890691f7ab5915e Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 6 Sep 2019 22:45:11 +0200 Subject: [PATCH] Avoid crash, and send error message when r,l,c instance lines does not have enough tokens. --- src/frontend/inpcom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 8c41e8ade..c2c58dae2 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -7461,6 +7461,11 @@ static struct card *pspice_compat(struct card *oldcard) char *ntok = nexttok(cut_line); ntok = nexttok(ntok); ntok = nexttok(ntok); + if (!ntok){ + fprintf(stderr, "Error: Missing token in line %d:\n%s\n", card->linenum, cut_line); + fprintf(stderr, " Please correct the input file\n"); + controlled_exit(1); + } char *tctok = search_plain_identifier(ntok, "tc"); if (tctok) { char *tctok1 = strchr(tctok, '=');