Ignore sessions that cannot be parsed

This commit is contained in:
Konstantinos Sideris 2018-09-16 11:19:18 +03:00
parent a9ddc3b3d3
commit 9ad4aab657
1 changed files with 8 additions and 1 deletions

View File

@ -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;