Fix rooms failing to load over dbus if image can't be downloaded

This commit is contained in:
Nicolas Werner 2022-07-10 15:25:41 +02:00
parent af03138527
commit 6ead7b0ba2
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -21,6 +21,8 @@ NhekoDBusBackend::NhekoDBusBackend(RoomlistModel *parent)
QVector<nheko::dbus::RoomInfoItem>
NhekoDBusBackend::rooms(const QDBusMessage &message)
{
message.setDelayedReply(true);
const auto roomListModel = m_parent->models;
QSharedPointer<QVector<nheko::dbus::RoomInfoItem>> model{
new QVector<nheko::dbus::RoomInfoItem>};
@ -43,8 +45,8 @@ NhekoDBusBackend::rooms(const QDBusMessage &message)
room->roomId(), alias, room->roomName(), image, room->notificationCount()});
if (model->length() == roomListModelSize) {
auto reply = message.createReply();
nhlog::ui()->debug("Sending {} rooms over D-Bus...", model->size());
auto reply = message.createReply();
reply << QVariant::fromValue(*model);
QDBusConnection::sessionBus().send(reply);
nhlog::ui()->debug("Rooms successfully sent to D-Bus.");