From 3a610c6187dad25497582d3c6cdfcf6f7de61566 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 30 Sep 2011 03:20:47 +0200 Subject: [PATCH] dont fail if no frame is selected --- pandora/item/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 9eefc90d0..86472991a 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -460,8 +460,9 @@ class Item(models.Model): if keys and 'frames' in keys: i['frames'] = frames - if frames: - i['posterFrame'] = filter(lambda f: f['selected'], frames)[0]['position'] + selected_frame = filter(lambda f: f['selected'], frames) + if selected_frame: + i['posterFrame'] = selected_frame[0]['position'] elif self.poster_frame != -1.0: i['posterFrame'] = self.poster_frame