Salome HOME
Crash on abort of any non-sketch operation.
[modules/shaper.git] / src / XGUI / XGUI_ActionsMgr.cpp
index 081ab537f9c7a6ab02e2b24ab4873b78388813f9..0468a39f75bc4ba8c5da482cdb115eefa28d89b1 100644 (file)
@@ -115,9 +115,11 @@ void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, const QString& t
 
 void XGUI_ActionsMgr::setActionChecked(const QString& theId, const bool theChecked)
 {
-  QAction* anAction = myActions[theId];
-  if (anAction && anAction->isCheckable()) {
-    anAction->setChecked(theChecked);
+  if (myActions.contains(theId)) {
+    QAction* anAction = myActions[theId];
+    if (anAction->isCheckable()) {
+      anAction->setChecked(theChecked);
+    }
   }
 }
 
@@ -135,8 +137,7 @@ void XGUI_ActionsMgr::updateByDocumentKind()
     QString aCmdDocKind;
     if(aCmd) {
       aCmdDocKind = aCmd->documentKind();
-    }
-    else {
+    } else {
       QString aId = eachAction->data().toString();
       if (!aId.isEmpty()) {
         aCmdDocKind = aWorkshop->salomeConnector()->documentKind(aId);
@@ -150,9 +151,8 @@ void XGUI_ActionsMgr::updateByDocumentKind()
 
 void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabled)
 {
-  QAction* anAction = myActions[theId];
-  if (anAction) {
-    anAction->setEnabled(theEnabled);
+  if (myActions.contains(theId)) {
+    myActions[theId]->setEnabled(theEnabled);
   }
 }