Prevent addition of false plot when current plot panel is not in m_plots

Without this commit, when `currentPlotWindow()` returned a valid
pointer, but one that is not used as a key in `m_plots`, it would get
inserted to the `m_plots` map. Because this pointer was not properly
initialized, a crash would later occur. I think this problem was
triggered by the pointer to welcome page, but I haven't checked.

Fixes https://gitlab.com/kicad/code/kicad/issues/7324
This commit is contained in:
Mikolaj Wielgus 2021-01-30 01:41:50 +01:00
parent 73886aecb1
commit babda304d9
1 changed files with 2 additions and 1 deletions

View File

@ -437,7 +437,8 @@ void SIM_PLOT_FRAME::StartSimulation( const wxString& aSimCommand )
if( aSimCommand.IsEmpty() )
{
SIM_PANEL_BASE* plotPanel = currentPlotWindow();
if( plotPanel )
if( plotPanel && m_plots.count( plotPanel ) != 0 )
m_exporter->SetSimCommand( m_plots[plotPanel].m_simCommand );
}
else