]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2102: Do not get object with Id of obsolete folder
authorvsv <vsv@opencascade.com>
Wed, 5 Apr 2017 13:20:59 +0000 (16:20 +0300)
committervsv <vsv@opencascade.com>
Wed, 5 Apr 2017 13:21:21 +0000 (16:21 +0300)
src/XGUI/XGUI_DataModel.cpp

index 2eef35a764ad3cc07869240ddb8a9d30aadfbfa4..88fb28eeb6c6eff05766fad8028f74dd1611e778 100644 (file)
@@ -644,7 +644,11 @@ QModelIndex XGUI_DataModel::index(int theRow, int theColumn, const QModelIndex &
           } else {
             // this is an object under sub document root
             std::string aType = myXMLReader->subType();
-            ObjectPtr aObj = aSubDoc->object(aType, theRow - aNbSubFolders);
+            int aCount = theRow - aNbSubFolders;
+            // To check number of objects before using
+            if (aSubDoc->size(aType) <= aCount)
+              return QModelIndex();
+            ObjectPtr aObj = aSubDoc->object(aType, aCount);
             aIndex = objectIndex(aObj);
           }
         } else {