From 95df9e32448945e73f634845f1884d3846b938c2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 17 Apr 2024 19:41:15 +0200 Subject: [PATCH] Sketcher: fix crash in CmdRenderingOrder::updateIcon() If a parameter in the observed parameter group is changed then CmdRenderingOrder::OnChange() is called but the ActionGroup may not be created yet --- src/Mod/Sketcher/Gui/Command.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index ceb96a846c..b52ab63a3a 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -1771,16 +1771,16 @@ void CmdRenderingOrder::updateIcon() Gui::BitmapFactory().iconFromTheme("Sketcher_RenderingOrder_Construction"); static QIcon external = Gui::BitmapFactory().iconFromTheme("Sketcher_RenderingOrder_External"); - auto* pcAction = qobject_cast(getAction()); - - if (TopElement == ElementType::Normal) { - pcAction->setIcon(normal); - } - else if (TopElement == ElementType::Construction) { - pcAction->setIcon(construction); - } - else if (TopElement == ElementType::External) { - pcAction->setIcon(external); + if (auto* pcAction = qobject_cast(getAction())) { + if (TopElement == ElementType::Normal) { + pcAction->setIcon(normal); + } + else if (TopElement == ElementType::Construction) { + pcAction->setIcon(construction); + } + else if (TopElement == ElementType::External) { + pcAction->setIcon(external); + } } }