fix a crash when netlisting top level elements in print_spice_element(), attempting to look up format string tokens into non-existent parent level (xctx->currsch-1 = -1))

This commit is contained in:
stefan schippers 2024-03-21 14:41:15 +01:00
parent 85abc67c89
commit 058b96ba7a
2 changed files with 2 additions and 1 deletions

View File

@ -2680,6 +2680,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
if(!cancel) {
if(f[0]) {
dbg(0, "f=%s\n", f);
new_schematic("create", "noconfirm", f, 1);
tclvareval("update_recent_file {", f, "}", NULL);
} else {

View File

@ -2164,7 +2164,7 @@ int print_spice_element(FILE *fd, int inst)
my_strdup2(_ALLOC_ID_, &val, get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0));
tok_size = xctx->tok_size;
value = val;
if(strchr(value, '@')) {
if(xctx->currsch > 0 && strchr(value, '@')) {
/* Symbol format string contains model=@modp,
* instance attributes does not contain a modp=xxx,
* look up modp in **parent** instance prop_ptr and symbol template attribute */