osc: paint over a crash

Sometimes tries to index a nil object when seeking close to the end of
the file. See #1101.
This commit is contained in:
wm4 2015-04-22 18:52:55 +02:00
parent 777273c064
commit 589533d97a
1 changed files with 6 additions and 4 deletions

View File

@ -266,11 +266,13 @@ end
-- get the currently selected track of <type>, OSC-style counted
function get_track(type)
local track = mp.get_property(type)
if (track == "no" or track == nil) then
return 0
else
return tracks_mpv[type][tonumber(track)].osc_id
if track ~= "no" and track ~= nil then
local tr = tracks_mpv[type][tonumber(track)]
if tr then
return tr.osc_id
end
end
return 0
end