summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-06-20 21:56:12 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-06-20 21:56:12 +0200
commit3357dc21a5bc69c59ada9e25ea5b3ebeaf483bc1 (patch)
tree85511582c9868f91d702248795c870d4556b4ea6 /src
parentAllow setting a scale factor on Windows (diff)
downloadnheko-3357dc21a5bc69c59ada9e25ea5b3ebeaf483bc1.tar.xz
Skip users we don't share a room with in invite dialog
Fixes #1757
Diffstat (limited to 'src')
-rw-r--r--src/UsersModel.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/UsersModel.cpp b/src/UsersModel.cpp
index 28f6c6fa..61d1bddd 100644
--- a/src/UsersModel.cpp
+++ b/src/UsersModel.cpp
@@ -25,10 +25,13 @@ UsersModel::UsersModel(const std::string &roomId, QObject *parent)
                   std::get_if<mtx::events::AccountDataEvent<mtx::events::account_data::Direct>>(
                     &e.value())) {
                 for (const auto &[userId, roomIds] : event->content.user_to_rooms) {
+                    if (roomIds.empty())
+                        continue;
+
                     displayNames.push_back(
-                      QString::fromStdString(cache::displayName(roomIds[0], userId)));
+                      QString::fromStdString(cache::displayName(roomIds.at(0), userId)));
                     userids.push_back(QString::fromStdString(userId));
-                    avatarUrls.push_back(cache::avatarUrl(QString::fromStdString(roomIds[0]),
+                    avatarUrls.push_back(cache::avatarUrl(QString::fromStdString(roomIds.at(0)),
                                                           QString::fromStdString(userId)));
                 }
             }