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
This commit is contained in:
wmayer
2024-04-17 19:41:15 +02:00
committed by wwmayer
parent 83abfa49b8
commit 95df9e3244

View File

@@ -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<Gui::ActionGroup*>(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<Gui::ActionGroup*>(getAction())) {
if (TopElement == ElementType::Normal) {
pcAction->setIcon(normal);
}
else if (TopElement == ElementType::Construction) {
pcAction->setIcon(construction);
}
else if (TopElement == ElementType::External) {
pcAction->setIcon(external);
}
}
}