Skip to content
Snippets Groups Projects
Verified Commit 801af186 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix off-by-1 in insertRows when loading room list from initial sync

parent 68851ee5
No related branches found
No related tags found
No related merge requests found
Pipeline #1363 failed
......@@ -162,7 +162,7 @@ appimage-amd64:
before_script:
# app build requirements
- apt-get update && apt-get install -y software-properties-common
- add-apt-repository ppa:beineri/opt-qt-5.15.2-xenial -y
- add-apt-repository ppa:beineri/opt-qt-5.15.2-bionic -y
- apt-get update
- apt-get install -y git wget curl
......
......@@ -348,7 +348,7 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
beginInsertRows(QModelIndex(),
(int)roomids.size(),
(int)(roomids.size() + previewsToAdd.size() -
((wasInvite || wasPreview) ? 0 : 1)));
((wasInvite || wasPreview) ? 1 : 0)));
models.insert(room_id, std::move(newRoom));
if (wasInvite) {
......@@ -368,7 +368,8 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
roomids.push_back(std::move(p));
}
if (!suppressInsertNotification && !wasInvite)
if (!suppressInsertNotification &&
((!wasInvite && !wasPreview) || !previewedRooms.empty()))
endInsertRows();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment