fix net_name() crashing if inst[i].node==NULL. This may happen when pasting a component that contains a @@xxx token, that needs to be expanded to attached netname, however since we are moving the component no net name is defined --> .node==NULL.

This commit is contained in:
Stefan Frederik 2022-08-30 02:44:28 +02:00
parent f5b0cd933c
commit adc4eb96c8
2 changed files with 7 additions and 3 deletions

View File

@ -758,6 +758,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
cmd_found = 1;
l = expandlabel(argv[2], &tmp);
llen = strlen(l);
dbg(0, "l=%s\n", l ? l : "<NULL>");
result = my_malloc(378, llen + 30);
my_snprintf(result, llen + 30, "%s %d", l, tmp);
Tcl_SetResult(interp, result, TCL_VOLATILE);

View File

@ -2730,6 +2730,12 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
char *pinname = NULL;
/* if merging a ngspice_probe.sym element it contains a @@p token,
* so translate calls net_name, but we are placing the merged objects,
* no net name is assigned yet */
if(!xctx->inst[i].node) {
return expandlabel("", multip);
}
if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL)
{
my_strdup(1508, &pinname, get_tok_value( sym->rect[PINLAYER][j].prop_ptr,"name",0));
@ -2744,9 +2750,6 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
break;
}
}
}
if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL)
{
expandlabel(pinname, multip);
if(pinname) my_free(1511, &pinname);
if(erc) {