Ignore sessions that cannot be parsed

remotes/origin/HEAD
Konstantinos Sideris 6 years ago
parent a9ddc3b3d3
commit 9ad4aab657
  1. 9
      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;

Loading…
Cancel
Save