[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.
reviewable/pr9335/r1
Stephane Albert 2 years ago committed by GitHub
parent e679b00d0a
commit fc7f0bacf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save