diff --git a/cockatrice/src/game/cards/card_database_model.cpp b/cockatrice/src/game/cards/card_database_model.cpp index fb105d424..31ff98263 100644 --- a/cockatrice/src/game/cards/card_database_model.cpp +++ b/cockatrice/src/game/cards/card_database_model.cpp @@ -179,7 +179,8 @@ void CardDatabaseDisplayModel::fetchMore(const QModelIndex &index) return; } - beginInsertRows(QModelIndex(), loadedRowCount, loadedRowCount + itemsToFetch - 1); + const auto startIndex = qMin(rowCount(QModelIndex()), loadedRowCount); + beginInsertRows(QModelIndex(), startIndex, startIndex + itemsToFetch - 1); loadedRowCount += itemsToFetch; endInsertRows();