diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 76ec66d7f..b772baa0b 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -829,10 +829,12 @@ void CmdSketcherConstrainLock::updateAction(int mode) { switch (mode) { case Reference: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock_Driven")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock_Driven")); break; case Driving: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_ConstrainLock")); break; } } @@ -1100,10 +1102,12 @@ void CmdSketcherConstrainDistance::updateAction(int mode) { switch (mode) { case Reference: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length_Driven")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length_Driven")); break; case Driving: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Length")); break; } } @@ -1342,10 +1346,12 @@ void CmdSketcherConstrainDistanceX::updateAction(int mode) { switch (mode) { case Reference: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance_Driven")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance_Driven")); break; case Driving: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_HorizontalDistance")); break; } } @@ -1497,10 +1503,12 @@ void CmdSketcherConstrainDistanceY::updateAction(int mode) { switch (mode) { case Reference: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance_Driven")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance_Driven")); break; case Driving: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_VerticalDistance")); break; } } @@ -2493,10 +2501,12 @@ void CmdSketcherConstrainRadius::updateAction(int mode) { switch (mode) { case Reference: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius_Driven")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius_Driven")); break; case Driving: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_Radius")); break; } } @@ -2765,10 +2775,12 @@ void CmdSketcherConstrainAngle::updateAction(int mode) { switch (mode) { case Reference: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle_Driven")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle_Driven")); break; case Driving: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Constraint_InternalAngle")); break; } } diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 3fc096e78..976c9cbe2 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -328,10 +328,12 @@ void CmdSketcherCreateLine::updateAction(int mode) { switch (mode) { case Normal: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine")); break; case Construction: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine_Constr")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateLine_Constr")); break; } } @@ -569,10 +571,12 @@ void CmdSketcherCreateRectangle::updateAction(int mode) { switch (mode) { case Normal: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle")); break; case Construction: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle_Constr")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateRectangle_Constr")); break; } } @@ -1184,10 +1188,12 @@ void CmdSketcherCreatePolyline::updateAction(int mode) { switch (mode) { case Normal: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline")); break; case Construction: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline_Constr")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreatePolyline_Constr")); break; } } @@ -1826,6 +1832,9 @@ Gui::Action * CmdSketcherCompCreateArc::createAction(void) void CmdSketcherCompCreateArc::updateAction(int mode) { Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction()); + if (!pcAction) + return; + QList<QAction*> a = pcAction->actions(); int index = pcAction->property("defaultAction").toInt(); switch (mode) { @@ -3399,6 +3408,9 @@ Gui::Action * CmdSketcherCompCreateConic::createAction(void) void CmdSketcherCompCreateConic::updateAction(int mode) { Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction()); + if (!pcAction) + return; + QList<QAction*> a = pcAction->actions(); int index = pcAction->property("defaultAction").toInt(); switch (mode) { @@ -3752,6 +3764,9 @@ Gui::Action * CmdSketcherCompCreateCircle::createAction(void) void CmdSketcherCompCreateCircle::updateAction(int mode) { Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction()); + if (!pcAction) + return; + QList<QAction*> a = pcAction->actions(); int index = pcAction->property("defaultAction").toInt(); switch (mode) { @@ -4914,10 +4929,12 @@ void CmdSketcherCreateSlot::updateAction(int mode) { switch (mode) { case Normal: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot")); break; case Construction: - getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot_Constr")); + if (getAction()) + getAction()->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateSlot_Constr")); break; } } @@ -5354,6 +5371,9 @@ Gui::Action * CmdSketcherCompCreateRegularPolygon::createAction(void) void CmdSketcherCompCreateRegularPolygon::updateAction(int mode) { Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(getAction()); + if (!pcAction) + return; + QList<QAction*> a = pcAction->actions(); int index = pcAction->property("defaultAction").toInt(); switch (mode) {