From 9ad4aab657b551c107e8b437bfc8bb5b1a6757b8 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 16 Sep 2018 11:19:18 +0300 Subject: Ignore sessions that cannot be parsed --- src/Cache.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Cache.cpp') diff --git a/src/Cache.cpp b/src/Cache.cpp index cbff2ca6..feadb006 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -224,9 +224,16 @@ Cache::exportSessionKeys() std::string key, value; while (cursor.get(key, value, MDB_NEXT)) { ExportedSession exported; + MegolmSessionIndex index; auto saved_session = unpickle(value, SECRET); - auto index = nlohmann::json::parse(key).get(); + + try { + index = nlohmann::json::parse(key).get(); + } catch (const nlohmann::json::exception &e) { + nhlog::db()->critical("failed to export megolm session: {}", e.what()); + continue; + } exported.room_id = index.room_id; exported.sender_key = index.sender_key; -- cgit 1.4.1