]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #384: Crash on second creation of group is fixed
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 14 Jul 2015 13:10:54 +0000 (16:10 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 14 Jul 2015 13:11:11 +0000 (16:11 +0300)
src/PartSet/PartSet_PartDataModel.cpp

index 98eed0060821f6f9555de82f04d3f30c4daa9c19..fff14f9d4b0ae97eae84c6443eff4f5511391caa 100644 (file)
@@ -140,12 +140,19 @@ QVariant PartSet_PartDataModel::data(const QModelIndex& theIndex, int theRole) c
         case ConstructObject:
         case GroupObject:
         case BodiesObject: {
-          std::string aGroup = theIndex.internalId() == ConstructObject ?
-            ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group();
-          ObjectPtr anObject = aPartDoc->object(aGroup, theIndex.row());
-          if (anObject && anObject->data() && 
-              anObject->data()->execState() == ModelAPI_StateMustBeUpdated) {
-            return QIcon(":pictures/constr_object_modified.png");
+          std::string aGroup;
+          if (theIndex.internalId() == ConstructObject)
+            aGroup = ModelAPI_ResultConstruction::group();
+          else if (theIndex.internalId() == BodiesObject)
+            aGroup = ModelAPI_ResultBody::group();
+          else if (theIndex.internalId() == GroupObject)
+            aGroup = ModelAPI_ResultGroup::group();
+          if (aGroup.length() > 0) {
+            ObjectPtr anObject = aPartDoc->object(aGroup, theIndex.row());
+            if (anObject && anObject->data() && 
+                anObject->data()->execState() == ModelAPI_StateMustBeUpdated) {
+              return QIcon(":pictures/constr_object_modified.png");
+            }
           }
           return QIcon(":pictures/constr_object.png");
         }