Salome HOME
Refresh menu size after chnges in preferences
[modules/shaper.git] / src / XGUI / XGUI_DocumentDataModel.cpp
index 7b4db23661673fcab2ffc55a5631e4f5bdbf3b50..6082e445bb56df332252a752caa11c14477e13dd 100644 (file)
@@ -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()?