safeguard against empty lines which may be sent to shared ngspice

This commit is contained in:
Holger Vogt 2020-05-06 11:12:21 +02:00
parent 5c3e2b6526
commit 05bf86caaa
1 changed files with 10 additions and 4 deletions

View File

@ -8128,14 +8128,16 @@ struct card *ltspice_compat(struct card *oldcard)
static struct card *subcktline = NULL;
static int nesting = 0;
char *cut_line = card->line;
if (ciprefix(".subckt", cut_line)) {
if (*cut_line == '*' || *cut_line == '\0')
continue;
else if (ciprefix(".subckt", cut_line)) {
subcktline = card;
nesting++;
}
if (ciprefix(".ends", cut_line))
else if (ciprefix(".ends", cut_line))
nesting--;
if (ciprefix(".model", card->line) &&
else if (ciprefix(".model", card->line) &&
search_plain_identifier(card->line, "d")) {
if (search_plain_identifier(card->line, "roff") ||
search_plain_identifier(card->line, "ron") ||
@ -8187,6 +8189,8 @@ struct card *ltspice_compat(struct card *oldcard)
char *cut_line = card->line;
if (*cut_line == '*')
continue;
if (*cut_line == '\0')
continue;
// exclude any command inside .control ... .endc
if (ciprefix(".control", cut_line)) {
skip_control++;
@ -8256,7 +8260,7 @@ static void inp_check_syntax(struct card *deck)
for (card = deck; card; card = card->nextcard) {
char *cut_line = card->line;
if (*cut_line == '*')
if (*cut_line == '*' || *cut_line == '\0')
continue;
// check for .control ... .endc
if (ciprefix(".control", cut_line)) {
@ -8328,6 +8332,8 @@ static void rem_mfg_from_models(struct card *deck)
char *curr_line, *end, *start;
curr_line = start = card->line;
if (*curr_line == '*' || *curr_line == '\0')
continue;
/* remove mfg=name */
if (ciprefix(".model", curr_line)) {
start = strstr(curr_line, "mfg=");