Simulator: don't try to access an invalid map entry

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8273
This commit is contained in:
Jon Evans 2021-04-21 22:09:40 -04:00
parent e7d3bf29aa
commit 511f4cd03c
1 changed files with 5 additions and 4 deletions

View File

@ -458,8 +458,8 @@ bool SIM_PLOT_FRAME::IsSimulationRunning()
SIM_PANEL_BASE* SIM_PLOT_FRAME::NewPlotPanel( wxString aSimCommand )
{
SIM_PANEL_BASE* plotPanel;
SIM_TYPE simType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( aSimCommand );
SIM_PANEL_BASE* plotPanel = nullptr;
SIM_TYPE simType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( aSimCommand );
if( SIM_PANEL_BASE::IsPlottable( simType ) )
{
@ -972,7 +972,7 @@ bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
file.AddLine( wxString::Format( "%llu", m_plots.size() ) );
for( const auto& plot : m_plots )
for( const std::pair<SIM_PANEL_BASE*, PLOT_INFO> plot : m_plots )
{
if( plot.first )
{
@ -1306,7 +1306,8 @@ void SIM_PLOT_FRAME::onSettings( wxCommandEvent& event )
if( m_settingsDlg->ShowModal() == wxID_OK )
{
wxString oldCommand = m_plots[plotPanelWindow].m_simCommand;
wxString oldCommand = plotPanelWindow != m_welcomePanel ?
m_plots[plotPanelWindow].m_simCommand : wxString();
wxString newCommand = m_settingsDlg->GetSimCommand();
SIM_TYPE newSimType = NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType( newCommand );