Prevent a crash when number of nodes differs in subckt and X call.

This commit is contained in:
Holger Vogt 2023-05-12 17:00:08 +02:00
parent 8c9602574e
commit e834c89313
1 changed files with 12 additions and 0 deletions

View File

@ -895,6 +895,9 @@ void inp_probe(struct card* deck)
else if (err == 2) {
fprintf(stderr, "Warning: Zero voltage sources already set,\n .probe %s will be ignored\n", wltmp->wl_word);
}
else if (err == 3) {
fprintf(stderr, "Warning: Number of nodes mismatch,\n .probe %s will be ignored\n", wltmp->wl_word);
}
continue;
}
else if (!haveall) {
@ -1358,6 +1361,15 @@ static int setallvsources(struct card *tmpcard, NGHASHPTR instances, char *instn
char nodenumstr[3];
char *nodename1 = get_terminal_name(instname, itoa10(nodenum, nodenumstr), instances);
if (!nodename1) {
tfree(begstr);
tfree(strnode1);
ds_free(&BVrefline);
ds_free(&Bpowerline);
ds_free(&Bpowersave);
return 3;
}
newline = tprintf("%s %s %s", begstr, newnode, instline);
char* vline = tprintf("vcurr_%s:probe_int_%s:%s_%s %s %s 0", instname, nodename1, nodenumstr, strnode1, strnode1, newnode);