From: vsv Date: Wed, 5 Apr 2017 13:20:59 +0000 (+0300) Subject: Issue #2102: Do not get object with Id of obsolete folder X-Git-Tag: V_2.7.0~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b493920c4bb1fc7fbaf93c2c96500c5278396ffa;p=modules%2Fshaper.git Issue #2102: Do not get object with Id of obsolete folder --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 2eef35a76..88fb28eeb 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -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 {