From: vsv Date: Thu, 6 Sep 2018 14:05:53 +0000 (+0300) Subject: Avoid crash in case of non-initialized document X-Git-Tag: V9_2_0a1~50 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a526efa4e4ab373c9d56e526551f02ae11bdc2cf;p=modules%2Fshaper.git Avoid crash in case of non-initialized document --- diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index bf050f723..587082705 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -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);