From 43ba4d5ed5fa06fa5d5f093c6c3c0b12307dbb43 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Fri, 2 Feb 2018 10:50:02 -0700 Subject: [PATCH] Handle case with no available rooms fixes #181 --- src/TopRoomBar.cc | 3 +++ src/timeline/TimelineViewManager.cc | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/TopRoomBar.cc b/src/TopRoomBar.cc index dc597bc9..d34e59ad 100644 --- a/src/TopRoomBar.cc +++ b/src/TopRoomBar.cc @@ -144,6 +144,9 @@ TopRoomBar::TopRoomBar(QWidget *parent) menu_->addAction(leaveRoom_); connect(settingsBtn_, &QPushButton::clicked, this, [=]() { + if (roomSettings_.isNull()) + return; + if (roomSettings_->isNotificationsEnabled()) toggleNotifications_->setText(tr("Disable notifications")); else diff --git a/src/timeline/TimelineViewManager.cc b/src/timeline/TimelineViewManager.cc index 0a81b06b..7318ce2b 100644 --- a/src/timeline/TimelineViewManager.cc +++ b/src/timeline/TimelineViewManager.cc @@ -68,6 +68,9 @@ TimelineViewManager::messageSendFailed(const QString &roomid, int txn_id) void TimelineViewManager::queueTextMessage(const QString &msg) { + if (active_room_.isEmpty()) + return; + auto room_id = active_room_; auto view = views_[room_id]; @@ -77,6 +80,9 @@ TimelineViewManager::queueTextMessage(const QString &msg) void TimelineViewManager::queueEmoteMessage(const QString &msg) { + if (active_room_.isEmpty()) + return; + auto room_id = active_room_; auto view = views_[room_id];