From c973fd759b4aab6a6d2bcd892f78239057ffc7fb Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 20 Jun 2020 19:26:54 +0200 Subject: [PATCH] Fix m.relates_to being sent as 'null' when not set in encrypted messages. Thank you Sorunome for reporting. --- src/Olm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Olm.cpp b/src/Olm.cpp index 2c4f6186..994a3a67 100644 --- a/src/Olm.cpp +++ b/src/Olm.cpp @@ -168,7 +168,8 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id, // relations shouldn't be encrypted... mtx::common::ReplyRelatesTo relation; - if (body["content"]["m.relates_to"].contains("m.in_reply_to")) { + if (body["content"].contains("m.relates_to") && + body["content"]["m.relates_to"].contains("m.in_reply_to")) { relation = body["content"]["m.relates_to"]; body["content"].erase("m.relates_to"); }