From: mpv Date: Mon, 22 Jan 2018 12:43:11 +0000 (+0300) Subject: Fix for the issue #2417 : human name for a generic error X-Git-Tag: V_3.0.0RC1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=abcf526d706b39afd25aab67b922cc903c626c9d;p=modules%2Fshaper.git Fix for the issue #2417 : human name for a generic error --- diff --git a/src/BuildPlugin/BuildPlugin_Validators.cpp b/src/BuildPlugin/BuildPlugin_Validators.cpp index 8c58b4777..99140d20e 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.cpp +++ b/src/BuildPlugin/BuildPlugin_Validators.cpp @@ -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(); diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index ddd809ed6..946994559 100755 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -109,16 +109,14 @@ std::shared_ptr 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) diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index fd5c11630..4b3546211 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -119,7 +119,8 @@ void XGUI_WorkshopListener::initializeEventListening() //****************************************************** void XGUI_WorkshopListener::processEvent(const std::shared_ptr& 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