X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_DocumentDataModel.cpp;h=6082e445bb56df332252a752caa11c14477e13dd;hb=4224f4dbe7ceaefe74b5d6b79a5840a9f5df2d7a;hp=7b4db23661673fcab2ffc55a5631e4f5bdbf3b50;hpb=0c3a8a03ec5405d00c23a1cf9f20185d979ece1d;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index 7b4db2366..6082e445b 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -72,6 +72,7 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage) } else { // Update top groups (other except parts QModelIndex aIndex = myModel->findParent(aObject); int aStart = myModel->rowCount(aIndex) - 1; + if (aStart < 0) aStart = 0; aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex)); insertRow(aStart, aIndex); } @@ -539,8 +540,8 @@ QModelIndex XGUI_DocumentDataModel::objectIndex(const ObjectPtr theObject) const if (theObject == aRootDoc->object(ModelAPI_Feature::group(), aId)) break; } - Q_ASSERT(aId < aNb); - return index(aId + historyOffset(), 0, QModelIndex()); + if (aId < aNb) + return index(aId + historyOffset(), 0, QModelIndex()); } else { QModelIndex aIndex = myModel->objectIndex(theObject); return aIndex.isValid()?