From 230f3c27920048c2b4c68fc29a80375d875fe72c Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 28 Dec 2020 22:33:01 -0500 Subject: [PATCH] Fix crash when welcome panel was present in simulator and white background is toggled Fix #6872 --- eeschema/sim/sim_plot_frame.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 976481029f..2ea8dbaa09 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -1216,7 +1216,13 @@ void SIM_PLOT_FRAME::menuWhiteBackground( wxCommandEvent& event ) if( curPage == m_welcomePanel ) continue; - static_cast( 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( curPage ); + + if( panel != nullptr ) + { + panel->UpdatePlotColors(); + } } }