}
if (aPartModel) {
QModelIndex aIndex = aPartModel->findGroup(aGroup);
- int aStart = aPartModel->rowCount(aIndex);
- aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
- removeRow(aStart, aIndex);
+ if (aIndex.isValid()) {
+ int aStart = aPartModel->rowCount(aIndex);
+ aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
+ removeRow(aStart, aIndex);
+ } else {
+ int aRow = aPartModel->rowCount();
+ aIndex = createIndex(aPartModel->position() + historyOffset(), 0, HistoryNode);
+ removeRow(aRow, aIndex);
+ }
}
}
}