From 38867347fbf379fc6ba69d0b90033929269f6f3a Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Sun, 4 Jul 2021 13:36:23 +0200 Subject: [PATCH] prevent program crash, when playlist is not valid --- ffplayout/playlist.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ffplayout/playlist.py b/ffplayout/playlist.py index 5696f17d..f84540c2 100644 --- a/ffplayout/playlist.py +++ b/ffplayout/playlist.py @@ -186,7 +186,8 @@ def validate_thread(clip_nodes, list_date): check_length(counter, list_date) - if clip_nodes.get('program') and len(clip_nodes.get('program')) > 0: + if clip_nodes and clip_nodes.get('program') and \ + len(clip_nodes.get('program')) > 0: validate = Thread(name='check_json', target=check_json, args=(clip_nodes, list_date)) validate.daemon = True @@ -292,7 +293,8 @@ class GetSourceFromPlaylist: self.first = True self.last_error = self.playlist_reader.error - if self.playlist_reader.nodes.get('program'): + if self.playlist_reader.nodes and \ + self.playlist_reader.nodes.get('program'): self.clip_nodes = self.playlist_reader.nodes.get('program') self.node_count = len(self.clip_nodes)