]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1976: Application crashes when loading python script
authordbv <dbv@opencascade.com>
Wed, 18 Jan 2017 15:32:53 +0000 (18:32 +0300)
committerdbv <dbv@opencascade.com>
Wed, 18 Jan 2017 15:33:15 +0000 (18:33 +0300)
Fixed crash.

src/ModelHighAPI/ModelHighAPI_Selection.cpp

index 6b2862ae6fb411962ecfa86e6ed44df0efff4b59..e446cff41b16ea33f764baf76007f2fb14d22a2b 100644 (file)
@@ -104,8 +104,13 @@ std::string ModelHighAPI_Selection::shapeType() const
 //==================================================================================================
 void ModelHighAPI_Selection::setName(const std::string& theName)
 {
-  if (myVariantType == VT_ResultSubShapePair)
-    myResultSubShapePair.first->data()->setName(theName);
+  if (myVariantType == VT_ResultSubShapePair) {
+    std::shared_ptr<ModelAPI_Result> aResult = myResultSubShapePair.first;
+    if(!aResult.get()) {
+      return;
+    }
+    aResult->data()->setName(theName);
+  }
 }
 
 void ModelHighAPI_Selection::setColor(int theRed, int theGreen, int theBlue)