select.lua: fix select-edition crash on non-MKVs

In files other than MKVs edition-list is an empty table, not nil. It is
current-edition that is nil.

However nil still needs to be checked to not crash with mpv --idle.
This commit is contained in:
Guido Cella
2024-12-31 10:08:18 +01:00
committed by Kacper Michajłow
parent 1dd0e49f83
commit 50a3da73b7

View File

@@ -226,7 +226,7 @@ end)
mp.add_key_binding(nil, "select-edition", function ()
local edition_list = mp.get_property_native("edition-list")
if edition_list == nil or #edition_list == 1 then
if edition_list == nil or #edition_list < 2 then
show_error("No available editions.")
return
end