fix(picker.util): ignore errors from corrupted kv stores. Closes #2394

This commit is contained in:
Folke Lemaitre 2025-10-30 10:20:43 +01:00
parent 6cf2fee619
commit b3d01c59ba
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -28,8 +28,8 @@ function M.new(path, opts)
---@type string
local data = fd:read("*a")
fd:close()
---@diagnostic disable-next-line: assign-type-mismatch
self.data = require("string.buffer").decode(data) or {}
local ok, decoded = pcall(require("string.buffer").decode, data)
self.data = ok and decoded or {} --[[@as table<string, number>]]
end
return self
end