summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-01-08 12:48:39 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-01-08 12:48:39 +0100
commitcc9de7f3b0d0459a773a82a79a6c38bbf4ea6ea7 (patch)
tree7585efe4c35b98159f32730e6084ffc4b11ce069
parentBump gstreamer requirement (diff)
downloadnheko-cc9de7f3b0d0459a773a82a79a6c38bbf4ea6ea7.tar.xz
Fix some nulls in relations
Diffstat (limited to '')
-rw-r--r--src/Olm.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Olm.cpp b/src/Olm.cpp
index 07fc49f6..fe789560 100644
--- a/src/Olm.cpp
+++ b/src/Olm.cpp
@@ -579,13 +579,12 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id,
         mtx::common::RelatesTo r_relation;
 
         // relations shouldn't be encrypted...
-        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");
-        } else if (body["content"]["m.relates_to"].contains("event_id")) {
-                r_relation = body["content"]["m.relates_to"];
-                body["content"].erase("m.relates_to");
+        if (body["content"].contains("m.relates_to")) {
+                if (body["content"]["m.relates_to"].contains("m.in_reply_to")) {
+                        relation = body["content"]["m.relates_to"];
+                } else if (body["content"]["m.relates_to"].contains("event_id")) {
+                        r_relation = body["content"]["m.relates_to"];
+                }
         }
 
         auto payload = olm::client()->encrypt_group_message(session.get(), body.dump());