Commit 99cfe459 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLSub: Handle incomplete/invalid result sets without crashing

(cherry picked from commit 554675f5)
Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 2c91462d
......@@ -1632,20 +1632,27 @@ function display_subtitles()
local mainlist = input_table["mainlist"]
mainlist:clear()
if openSub.itemStore == "0" then
mainlist:add_value(lang["mess_no_res"], 1)
setMessage("<b>"..lang["mess_complete"]..":</b> "..
lang["mess_no_res"])
elseif openSub.itemStore then
if not openSub.itemStore then return end
if openSub.itemStore ~= "0" then
local nbRes = 0
for i, item in ipairs(openSub.itemStore) do
mainlist:add_value(
item.SubFileName..
" ["..item.SubLanguageID.."]"..
" ("..item.SubSumCD.." CD)", i)
if next(item) then
mainlist:add_value(
item.SubFileName..
" ["..item.SubLanguageID.."]"..
" ("..item.SubSumCD.." CD)", i)
nbRes = nbRes + 1
end
end
if nbRes > 0 then
setMessage("<b>"..lang["mess_complete"]..":</b> "..
#(openSub.itemStore).." "..lang["mess_res"])
return
end
setMessage("<b>"..lang["mess_complete"]..":</b> "..
#(openSub.itemStore).." "..lang["mess_res"])
end
mainlist:add_value(lang["mess_no_res"], 1)
setMessage("<b>"..lang["mess_complete"]..":</b> "..
lang["mess_no_res"])
end
function get_first_sel(list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment