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();
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)
//******************************************************
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