diff --git a/modules/m_relation.cc b/modules/m_relation.cc index c0cba8390..7e919b14b 100644 --- a/modules/m_relation.cc +++ b/modules/m_relation.cc @@ -75,9 +75,16 @@ try if(!m_relates_to || json::type(m_relates_to) != json::OBJECT) return; - const event::id &event_id + const json::object &m_in_reply_to { - m_relates_to.get("event_id") + content["m.in_reply_to"] + }; + + const m::event::id &event_id + { + json::type(m_in_reply_to, std::nothrow) == json::OBJECT? + m_in_reply_to.get("event_id"): + m_relates_to.get("event_id") }; // If the relates_to is a prev_event then the vm::fetch unit will perform