summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-06-18 00:10:47 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-06-18 00:10:47 +0200
commitb57152a1c906c4c97e853c3d19770bd515e1d44f (patch)
treeb61f450e2a050430c7747accccaee284599664d7 /src/Cache.cpp
parentAdded escape handler for uploads (#1100) (diff)
downloadnheko-b57152a1c906c4c97e853c3d19770bd515e1d44f.tar.xz
Skip migration if sender_key is not a string or present
Diffstat (limited to '')
-rw-r--r--src/Cache.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 1df16bf5..e8578655 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -1326,7 +1326,9 @@ Cache::runMigrations()
                std::map<std::string, std::string> inboundSessions;
                std::map<std::string, std::string> megolmSessionData;
                while (cursor.get(key, value, MDB_NEXT)) {
-                   auto indexVal   = nlohmann::json::parse(key);
+                   auto indexVal = nlohmann::json::parse(key);
+                   if (!indexVal.contains("sender_key") || !indexVal.at("sender_key").is_string())
+                       continue;
                    auto sender_key = indexVal["sender_key"].get<std::string>();
                    indexVal.erase("sender_key");