From 058b96ba7a440848dfb14440bf022933de917d49 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Thu, 21 Mar 2024 14:41:15 +0100 Subject: [PATCH] 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)) --- src/scheduler.c | 1 + src/token.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scheduler.c b/src/scheduler.c index a49d3883..2cc3d72d 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -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 { diff --git a/src/token.c b/src/token.c index 8142607b..af9e3c54 100644 --- a/src/token.c +++ b/src/token.c @@ -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 */