From 34861fb9b94b71d4dc916d0fedc70927aba4304d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 21 Jul 2022 21:45:33 -0400 Subject: [PATCH] Ensure a handle is valid before trying to use it to start playback --- resources/lib/play_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/lib/play_utils.py b/resources/lib/play_utils.py index eb85b92..36df5e9 100644 --- a/resources/lib/play_utils.py +++ b/resources/lib/play_utils.py @@ -458,11 +458,14 @@ def play_file(play_info): playlist.add(playurl, list_item) player.play(playlist) else: - if len(sys.argv) > 1: - # Play from within addon + if len(sys.argv) > 1 and int(sys.argv[1]) > 0: + # Play from info menu xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, list_item) else: - # Play from remote control. Doesn't have a handle, so need to call player directly + ''' + Play from remote control or addon menus. Doesn't have a handle, + so need to call player directly + ''' playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) playlist.clear() playlist.add(playurl, list_item)