]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid crash in case of non-initialized document
authorvsv <vsv@opencascade.com>
Thu, 6 Sep 2018 14:05:53 +0000 (17:05 +0300)
committervsv <vsv@opencascade.com>
Thu, 6 Sep 2018 14:06:13 +0000 (17:06 +0300)
src/PartSet/PartSet_TreeNodes.cpp

index bf050f7237d4c625202e73a48216bed77b007db4..5870827053098a206022edf6b9dcb072494273c1 100644 (file)
@@ -441,17 +441,19 @@ QVariant PartSet_FolderNode::data(int theColumn, int theRole) const
     }
   }
   if ((theColumn == 2) && (theRole == Qt::DecorationRole)) {
-    FeaturePtr aFeature = document()->currentFeature(true);
-    if (!aFeature.get()) { // There is no current feature
-      ModuleBase_ITreeNode* aLastFolder = 0;
-      foreach(ModuleBase_ITreeNode* aNode, parent()->children()) {
-        if (aNode->type() == PartSet_FolderNode::typeId())
-          aLastFolder = aNode;
-        else
-          break;
+    if (document().get()) {
+      FeaturePtr aFeature = document()->currentFeature(true);
+      if (!aFeature.get()) { // There is no current feature
+        ModuleBase_ITreeNode* aLastFolder = 0;
+        foreach(ModuleBase_ITreeNode* aNode, parent()->children()) {
+          if (aNode->type() == PartSet_FolderNode::typeId())
+            aLastFolder = aNode;
+          else
+            break;
+        }
+        if (aLastFolder == this)
+          return QIcon(":pictures/arrow.png");
       }
-      if (aLastFolder == this)
-        return QIcon(":pictures/arrow.png");
     }
   }
   return PartSet_TreeNode::data(theColumn, theRole);