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:
parent
f5b0cd933c
commit
adc4eb96c8
|
|
@ -758,6 +758,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
||||||
cmd_found = 1;
|
cmd_found = 1;
|
||||||
l = expandlabel(argv[2], &tmp);
|
l = expandlabel(argv[2], &tmp);
|
||||||
llen = strlen(l);
|
llen = strlen(l);
|
||||||
|
dbg(0, "l=%s\n", l ? l : "<NULL>");
|
||||||
result = my_malloc(378, llen + 30);
|
result = my_malloc(378, llen + 30);
|
||||||
my_snprintf(result, llen + 30, "%s %d", l, tmp);
|
my_snprintf(result, llen + 30, "%s %d", l, tmp);
|
||||||
Tcl_SetResult(interp, result, TCL_VOLATILE);
|
Tcl_SetResult(interp, result, TCL_VOLATILE);
|
||||||
|
|
|
||||||
|
|
@ -2730,6 +2730,12 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
|
||||||
char *pinname = NULL;
|
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)
|
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));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL)
|
|
||||||
{
|
|
||||||
expandlabel(pinname, multip);
|
expandlabel(pinname, multip);
|
||||||
if(pinname) my_free(1511, &pinname);
|
if(pinname) my_free(1511, &pinname);
|
||||||
if(erc) {
|
if(erc) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue