fix crash if doing alt-g on a subschematic port and no raw file loaded (send_net_to_graph())

This commit is contained in:
stefan schippers 2025-09-20 09:28:33 +02:00
parent ca786b60ab
commit cfff96093d
1 changed files with 2 additions and 1 deletions

View File

@ -1227,13 +1227,14 @@ static void send_net_to_graph(char **s, int simtype, const char *node)
const char *expanded_tok; const char *expanded_tok;
const char *tok; const char *tok;
char ss[1024] = ""; char ss[1024] = "";
int raw_level = (xctx->raw && xctx->raw->level != -1) ? xctx->raw->level : 0;
if(!node || !node[0]) return; if(!node || !node[0]) return;
tok = node; tok = node;
node_entry = bus_node_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", ""); node_entry = bus_node_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", "");
if(tok[0] == '#') tok++; if(tok[0] == '#') tok++;
if(node_entry && (node_entry->d.port == 0 || if(node_entry && (node_entry->d.port == 0 ||
/* !strcmp(xctx->sch_path[xctx->currsch], ".") */ /* !strcmp(xctx->sch_path[xctx->currsch], ".") */
xctx->currsch == xctx->raw->level xctx->currsch == raw_level
)) { )) {
char *t=NULL, *p=NULL; char *t=NULL, *p=NULL;
char *path; char *path;