aboutsummaryrefslogtreecommitdiff
path: root/events
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-02-26 19:13:15 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-02-26 19:13:15 +0900
commit988630bee00d54d64038c8216c64117e9ee02c61 (patch)
tree84a9d26d97f502d8df79cf9ea3ecfc2a10d8091c /events
parentc82198c9d35a2a91a7440851b6e7d7a71f662c68 (diff)
downloadlibquotient-988630bee00d54d64038c8216c64117e9ee02c61.tar.gz
libquotient-988630bee00d54d64038c8216c64117e9ee02c61.zip
Skip read events with an empty event id
Diffstat (limited to 'events')
-rw-r--r--events/receiptevent.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/events/receiptevent.cpp b/events/receiptevent.cpp
index 5267de4d..8029045a 100644
--- a/events/receiptevent.cpp
+++ b/events/receiptevent.cpp
@@ -70,6 +70,12 @@ ReceiptEvent* ReceiptEvent::fromJson(const QJsonObject& obj)
e->d->eventsToReceipts.reserve(contents.size());
for( auto eventIt = contents.begin(); eventIt != contents.end(); ++eventIt )
{
+ if (eventIt.key().isEmpty())
+ {
+ qWarning() << "ReceiptEvent has an empty event id, skipping";
+ qDebug() << "ReceiptEvent content follows:\n" << contents;
+ continue;
+ }
const QJsonObject reads = eventIt.value().toObject().value("m.read").toObject();
Receipts receipts; receipts.reserve(reads.size());
for( auto userIt = reads.begin(); userIt != reads.end(); ++userIt )