Fix crash when welcome panel was present in simulator and white background is toggled

Fix #6872
This commit is contained in:
Marek Roszko 2020-12-28 22:33:01 -05:00
parent 3adff647a7
commit 230f3c2792
1 changed files with 7 additions and 1 deletions

View File

@ -1216,7 +1216,13 @@ void SIM_PLOT_FRAME::menuWhiteBackground( wxCommandEvent& event )
if( curPage == m_welcomePanel )
continue;
static_cast<SIM_PLOT_PANEL*>( curPage )->UpdatePlotColors();
// ensure it is truely a plot panel and not the welcome panel which is only SIM_PLOT_PANEL_BASE
SIM_PLOT_PANEL* panel = dynamic_cast<SIM_PLOT_PANEL*>( curPage );
if( panel != nullptr )
{
panel->UpdatePlotColors();
}
}
}