From bf7efb18f99991c8890add286f9b97bd8936dcb8 Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Tue, 5 Apr 2022 12:16:31 +0100 Subject: [PATCH] Fix two crashes caused by trying to plot after circuit parsing failed. --- src/spicelib/analysis/cktfndm.c | 2 +- src/spicelib/devices/cktfinddev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spicelib/analysis/cktfndm.c b/src/spicelib/analysis/cktfndm.c index 05bf1b415..014ece655 100644 --- a/src/spicelib/analysis/cktfndm.c +++ b/src/spicelib/analysis/cktfndm.c @@ -16,5 +16,5 @@ Author: 1985 Thomas L. Quarles GENmodel * CKTfndMod(CKTcircuit *ckt, IFuid modname) { - return nghash_find(ckt->MODnameHash, modname); + return ckt ? nghash_find(ckt->MODnameHash, modname) : NULL; } diff --git a/src/spicelib/devices/cktfinddev.c b/src/spicelib/devices/cktfinddev.c index 818b5607b..b5115b283 100644 --- a/src/spicelib/devices/cktfinddev.c +++ b/src/spicelib/devices/cktfinddev.c @@ -13,5 +13,5 @@ Author: 1985 Thomas L. Quarles GENinstance * CKTfndDev(CKTcircuit *ckt, IFuid name) { - return nghash_find(ckt->DEVnameHash, name); + return ckt ? nghash_find(ckt->DEVnameHash, name) : NULL; }