diff options
author | CogentRedTester <cogent.redtester@outlook.com> | 2022-05-19 16:23:49 +0930 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-05-19 13:54:31 +0000 |
commit | b4c73ed10590ac7b7186f887ab1e24eeb68b35ce (patch) | |
tree | a2a0844cc56f5c7adb368685b3f255e28354ace4 /player/lua | |
parent | f20dbcd620ace15ff132d49e873adcb0d9527595 (diff) | |
download | mpv-b4c73ed10590ac7b7186f887ab1e24eeb68b35ce.tar.bz2 mpv-b4c73ed10590ac7b7186f887ab1e24eeb68b35ce.tar.xz |
osc.lua: fix crash when calling osc-tracklist while idle
If the player is started with --idle and the osc-tracklist script-message
is called then the tracks_osc table will be nil,
which caused the OSC to crash due to attempting to index a nil value.
This appears to be because the osc_tracklist variable is both
initialised and updated by (ultimately) the render() function, which
is not run when the player is idling.
Rather than mess with the existing OSC logic it's easier to either
add this single check, or alternatively to initialise the the tracks_osc
table somewhere before this.
Diffstat (limited to 'player/lua')
-rw-r--r-- | player/lua/osc.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua index cacc067c05..e1d6188814 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -367,7 +367,7 @@ end -- return a nice list of tracks of the given type (video, audio, sub) function get_tracklist(type) local msg = "Available " .. nicetypes[type] .. " Tracks: " - if #tracks_osc[type] == 0 then + if not tracks_osc or #tracks_osc[type] == 0 then msg = msg .. "none" else for n = 1, #tracks_osc[type] do |