]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #2417 : human name for a generic error
authormpv <mpv@opencascade.com>
Mon, 22 Jan 2018 12:43:11 +0000 (15:43 +0300)
committermpv <mpv@opencascade.com>
Mon, 22 Jan 2018 12:43:11 +0000 (15:43 +0300)
src/BuildPlugin/BuildPlugin_Validators.cpp
src/ModelAPI/ModelAPI_Tools.cpp
src/XGUI/XGUI_WorkshopListener.cpp

index 8c58b47772f8332b23483e73fbab521a0d87ff13..99140d20eb5c498ab7619a9751b11fedecd0eb22 100644 (file)
@@ -279,6 +279,10 @@ bool BuildPlugin_ValidatorBaseForSolids::isValid(
   ListOfShape anOriginalShapes;
   for (int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
     AttributeSelectionPtr aSelection = aSelectionList->value(anIndex);
+    if (!aSelection->context().get()) {
+      theError = "Invalid selection.";
+      return false;
+    }
     GeomShapePtr aShape = aSelection->value();
     if (!aShape.get())
       aShape = aSelection->context()->shape();
index ddd809ed663406e81dc2b5ac33420137c41a8ed9..94699455931d940d5a77df7ee257cc12f4187b3f 100755 (executable)
@@ -109,16 +109,14 @@ std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
 
 const char* toString(ModelAPI_ExecState theExecState)
 {
-#define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
   switch (theExecState) {
-  TO_STRING(ModelAPI_StateDone)
-  TO_STRING(ModelAPI_StateMustBeUpdated)
-  TO_STRING(ModelAPI_StateExecFailed)
-  TO_STRING(ModelAPI_StateInvalidArgument)
-  TO_STRING(ModelAPI_StateNothing)
+  case ModelAPI_StateDone: return "Done";
+  case ModelAPI_StateMustBeUpdated: return "Must be updated";
+  case ModelAPI_StateExecFailed: return "Execution failed";
+  case ModelAPI_StateInvalidArgument: return "Invalid argument";
+  case ModelAPI_StateNothing: return "Empty state";
   default: return "Unknown ExecState.";
   }
-#undef TO_STRING
 }
 
 std::string getFeatureError(const FeaturePtr& theFeature)
index fd5c11630267e7a01f080d7075db5377249bec53..4b3546211d2f1b4d540f3f01eb507b029daa91c2 100755 (executable)
@@ -119,7 +119,8 @@ void XGUI_WorkshopListener::initializeEventListening()
 //******************************************************
 void XGUI_WorkshopListener::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
-  if (QApplication::instance()->thread() != QThread::currentThread()) {
+  if (QApplication::instance() &&
+      QApplication::instance()->thread() != QThread::currentThread()) {
     #ifdef _DEBUG
     std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl;
     #endif