diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-16 11:19:18 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-09-16 11:19:18 +0300 |
commit | 9ad4aab657b551c107e8b437bfc8bb5b1a6757b8 (patch) | |
tree | c569874d6cc600b554020bd1d092db2c4913a70c /src/Cache.cpp | |
parent | Implement import/export of megolm session keys (#358) (diff) | |
download | nheko-9ad4aab657b551c107e8b437bfc8bb5b1a6757b8.tar.xz |
Ignore sessions that cannot be parsed
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r-- | src/Cache.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
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<InboundSessionObject>(value, SECRET); - auto index = nlohmann::json::parse(key).get<MegolmSessionIndex>(); + + try { + index = nlohmann::json::parse(key).get<MegolmSessionIndex>(); + } 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; |