diff --git a/src/Cache.cpp b/src/Cache.cpp index 67889543445a906658add44f90d1aa28c59d5081..c9baaf5ef640bd5f47b56b29bd08094e2befd615 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -4442,11 +4442,15 @@ Cache::markUserKeysOutOfDate(lmdb::txn &txn, std::string_view oldKeys; - UserKeyCache cacheEntry; + UserKeyCache cacheEntry{}; auto res = db.get(txn, user, oldKeys); if (res) { - cacheEntry = nlohmann::json::parse(std::string_view(oldKeys.data(), oldKeys.size())) - .get<UserKeyCache>(); + try { + cacheEntry = nlohmann::json::parse(std::string_view(oldKeys.data(), oldKeys.size())) + .get<UserKeyCache>(); + } catch (std::exception &e) { + nhlog::db()->error("Failed to parse {}: {}", oldKeys, e.what()); + } } cacheEntry.last_changed = sync_token;