mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user