[PocketBook] fix: Crash loading file extensions (#9327)

In some versions of the /ebrmain/config/extensions.cfg file there is a
comment #ebrcfg. This will not match the regex and crashes koreader as
the table is empty.
Add a check to ensure the table is not empty while reading extensions
from the default file.
This commit is contained in:
Stephane Albert
2022-07-14 11:46:25 +02:00
committed by GitHub
parent e679b00d0a
commit fc7f0bacf1

View File

@@ -296,7 +296,9 @@ function PocketBook:associateFileExtensions(assoc)
local info = {}
for l in io.lines("/ebrmain/config/extensions.cfg") do
local m = { l:match("^([^:]*):([^:]*):([^:]*):([^:]*):(.*)") }
info[m[1]] = m
if #m > 0 then
info[m[1]] = m
end
end
local res = {"#koreader"}
for k,v in pairs(assoc) do