From 2893b3331e64720913d42620e01690ed3f968c58 Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 29 Apr 2014 15:33:00 -0700 Subject: [PATCH] Fix for index out of range issues --- sickbeard/metadata/generic.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sickbeard/metadata/generic.py b/sickbeard/metadata/generic.py index 2bde6819..c68fd6a1 100644 --- a/sickbeard/metadata/generic.py +++ b/sickbeard/metadata/generic.py @@ -965,16 +965,17 @@ class GenericMetadata(): return None images = result.images() - # get backdrop urls - if backdrop: - rel_path = images['backdrops'][0]['file_path'] - url = "{0}{1}{2}".format(base_url, max_size, rel_path) - return url + if len(images) > 0: + # get backdrop urls + if backdrop: + rel_path = images['backdrops'][0]['file_path'] + url = "{0}{1}{2}".format(base_url, max_size, rel_path) + return url - # get poster urls - if poster: - rel_path = images['posters'][0]['file_path'] - url = "{0}{1}{2}".format(base_url, max_size, rel_path) - return url + # get poster urls + if poster: + rel_path = images['posters'][0]['file_path'] + url = "{0}{1}{2}".format(base_url, max_size, rel_path) + return url return None