fix(cache): handle corrupted cache files

This commit is contained in:
Folke Lemaitre 2023-03-24 21:22:13 +01:00
parent a80422f217
commit db5b67e75c
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 3 additions and 0 deletions

View File

@ -141,6 +141,9 @@ function Loader.read(name)
uv.fs_close(f) uv.fs_close(f)
local zero = data:find("\0", 1, true) local zero = data:find("\0", 1, true)
if not zero then
return
end
---@type integer[]|{[0]:integer} ---@type integer[]|{[0]:integer}
local header = vim.split(data:sub(1, zero - 1), ",") local header = vim.split(data:sub(1, zero - 1), ",")