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()
This commit is contained in:
Sylwester Kocjan 2022-04-02 14:25:39 +02:00 committed by Mikolaj Wielgus
parent 1594df3498
commit a9c61d21ca
1 changed files with 1 additions and 2 deletions

View File

@ -258,10 +258,9 @@ vector<double> NGSPICE::GetPhasePlot( const string& aName, int aMaxLen )
bool NGSPICE::Attach( const std::shared_ptr<SIMULATION_MODEL>& aModel )
{
NGSPICE_CIRCUIT_MODEL* model = dynamic_cast<NGSPICE_CIRCUIT_MODEL*>( aModel.get() );
wxASSERT( model != nullptr );
STRING_FORMATTER formatter;
if( model->GetNetlist( &formatter ) )
if( model && model->GetNetlist( &formatter ) )
{
SIMULATOR::Attach( aModel );