aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-11-19 14:56:09 +0100
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-11-19 14:59:14 +0100
commitdda813899fdb4a520dc83e10c17c1923712a8f7d (patch)
treeb685f8e5cb52c220ae0ffb19c7fbace47f2fab9c /lib/room.cpp
parent52cab4b11bdd48cd87e04c01b12c698ec4145e6d (diff)
downloadlibquotient-dda813899fdb4a520dc83e10c17c1923712a8f7d.tar.gz
libquotient-dda813899fdb4a520dc83e10c17c1923712a8f7d.zip
Fix Q_ASSERT failure on sending messages
Changes in e81117fb exposed a flaw in EncryptionEvent causing assertion failure when this event is default-initialised (i.e. no encryption).
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 7ac3463e..1af294a7 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -2580,8 +2580,14 @@ Room::Changes Room::processStateEvent(const RoomEvent& e)
// clang-format off
}
, [this, oldEncEvt = static_cast<const EncryptionEvent*>(oldStateEvent)](
- const EncryptionEvent&) {
+ const EncryptionEvent& ee) {
// clang-format on
+ if (ee.algorithm().isEmpty()) {
+ qWarning(STATE)
+ << "The encryption event for room" << objectName()
+ << "doesn't have 'algorithm' specified - ignoring";
+ return NoChange;
+ }
if (oldEncEvt
&& oldEncEvt->encryption() != EncryptionEventContent::Undefined) {
qCWarning(STATE) << "The room is already encrypted but a new"