From a9c61d21ca95dad9e97bee85f8f2363f4cf6ca7d Mon Sep 17 00:00:00 2001 From: Sylwester Kocjan Date: Sat, 2 Apr 2022 14:25:39 +0200 Subject: [PATCH] eeschema: fix crash when closing simulation frame Destructor of SIM_PLOT_FRAME calls sim->Attach( nullptr ) in order to destroy circuit model (former netlist exporter). If this is skipped, eeschema crashes when program is closed. nullptr is a valid parameter for Attach() --- eeschema/sim/ngspice.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 71b6b68332..7cdaade5b9 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -258,10 +258,9 @@ vector NGSPICE::GetPhasePlot( const string& aName, int aMaxLen ) bool NGSPICE::Attach( const std::shared_ptr& aModel ) { NGSPICE_CIRCUIT_MODEL* model = dynamic_cast( aModel.get() ); - wxASSERT( model != nullptr ); STRING_FORMATTER formatter; - if( model->GetNetlist( &formatter ) ) + if( model && model->GetNetlist( &formatter ) ) { SIMULATOR::Attach( aModel );