DocSettings: Fix candidates sorting (#9607)

The candidates array had a very very very high chance of being sparse, which effectively broke the logic.
It was mostly harmless since said logic is only here for a long and varied history of backwards compatibility ;).
This commit is contained in:
NiLuJe
2022-10-09 19:32:35 +02:00
committed by GitHub
parent 718b136c9a
commit c9ff0071e3
4 changed files with 71 additions and 55 deletions

View File

@@ -71,10 +71,10 @@ function LuaData:open(file_path, name)
if lfs.attributes(new.file, "mode") == "file" then
ok, err = loadfile(new.file, "t", data_env)
if ok then
logger.dbg("data is read from", new.file)
logger.dbg("LuaData: data is read from", new.file)
ok()
else
logger.dbg(new.file, "is invalid, removed.", err)
logger.dbg("LuaData:", new.file, "is invalid, removed.", err)
os.remove(new.file)
end
end
@@ -84,11 +84,11 @@ function LuaData:open(file_path, name)
if lfs.attributes(backup_file, "mode") == "file" then
ok, err = loadfile(backup_file, "t", data_env)
if ok then
logger.dbg("data is read from", backup_file)
logger.dbg("LuaData: data is read from", backup_file)
ok()
break
else
logger.dbg(backup_file, "is invalid, removed.", err)
logger.dbg("LuaData:", backup_file, "is invalid, removed.", err)
os.remove(backup_file)
end
end