diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2016-10-25 15:42:40 +0100 |
---|---|---|
committer | Ricardo Constantino <wiiaboo@gmail.com> | 2016-10-25 15:42:40 +0100 |
commit | 65c06511bf021eb101e54128f063d9da413ae901 (patch) | |
tree | c07f0d5c73f4cf53c91358c80f026f7ef6b62ec9 /player | |
parent | ee4bed25a85b2ef58557ab4f45ff62dbae3f863e (diff) | |
download | mpv-65c06511bf021eb101e54128f063d9da413ae901.tar.bz2 mpv-65c06511bf021eb101e54128f063d9da413ae901.tar.xz |
osc: fix crash with no chapters
Also, chapter position which wasn't changed to work with 1-based.
Diffstat (limited to 'player')
-rw-r--r-- | player/lua/osc.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 31e7a3a8cd..058a3f8d17 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -678,7 +678,7 @@ function limited_list(prop, pos) end function get_playlist() - local pos = mp.get_property_number('playlist-pos') + 1 + local pos = mp.get_property_number('playlist-pos', 0) + 1 local count, limlist = limited_list('playlist', pos) if count == 0 then return 'Empty playlist.' @@ -698,18 +698,18 @@ function get_playlist() end function get_chapterlist() - local pos = mp.get_property_number('chapter') + 1 + local pos = mp.get_property_number('chapter', 0) + 1 local count, limlist = limited_list('chapter-list', pos) if count == 0 then return 'No chapters.' end - local message = string.format('Chapters [%d/%d]:\n', pos + 1, count) + local message = string.format('Chapters [%d/%d]:\n', pos, count) for i, v in ipairs(limlist) do local time = mp.format_time(v.time) local title = v.title if title == nil then - title = string.format('Chapter %02d', i + 1) + title = string.format('Chapter %02d', i) end message = string.format('%s[%s] %s %s\n', message, time, (v.current and '●' or '○'), title) |