aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-01-13 18:21:51 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-01-13 18:21:51 +0900
commitd76424cb6c16cdef29761f00592db05989532a20 (patch)
tree538c41f9a7200888dfdf27baa535be9439c51f4a /lib
parent3cb7982fda8c0049eff51a9ab65eb43667e2c4ce (diff)
parente2c0148960e6e2b4595599de94d7a867f13782a0 (diff)
downloadlibquotient-d76424cb6c16cdef29761f00592db05989532a20.tar.gz
libquotient-d76424cb6c16cdef29761f00592db05989532a20.zip
Merge branch 'kitsune-fake-state-events-immunity'
Diffstat (limited to 'lib')
-rw-r--r--lib/events/stateevent.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/events/stateevent.cpp b/lib/events/stateevent.cpp
index c4151676..e96614d2 100644
--- a/lib/events/stateevent.cpp
+++ b/lib/events/stateevent.cpp
@@ -25,13 +25,15 @@ using namespace QMatrixClient;
// but the event type is unknown.
[[gnu::unused]] static auto stateEventTypeInitialised =
RoomEvent::factory_t::addMethod(
- [] (const QJsonObject& json, const QString& matrixType)
+ [] (const QJsonObject& json, const QString& matrixType) -> StateEventPtr
{
+ if (!json.contains("state_key"))
+ return nullptr;
+
if (auto e = StateEventBase::factory_t::make(json, matrixType))
return e;
- return json.contains("state_key")
- ? makeEvent<StateEventBase>(unknownEventTypeId(), json)
- : nullptr;
+
+ return makeEvent<StateEventBase>(unknownEventTypeId(), json);
});
bool StateEventBase::repeatsState() const