fix(cache): clear cached entry on errors

This commit is contained in:
Folke Lemaitre 2022-12-30 11:35:09 +01:00
parent d50eab2164
commit def5cc5816
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 3 additions and 1 deletions

View File

@ -189,9 +189,11 @@ function M.load(modkey, modpath)
end
chunk, err = M._loadfile(entry.modpath)
if chunk then
M.dirty = true
if chunk then
entry.chunk = string.dump(chunk)
else
M.cache[modkey] = nil
end
return chunk, err
end