From 1e5a6e1f871057fb1d3b932127092bf82674daf3 Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Fri, 16 Feb 2018 19:20:02 +0100 Subject: [PATCH] crash in narrative web if no unused media (#549) --- gramps/plugins/webreport/media.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/webreport/media.py b/gramps/plugins/webreport/media.py index 18142bf45..ebdd1fc75 100644 --- a/gramps/plugins/webreport/media.py +++ b/gramps/plugins/webreport/media.py @@ -158,7 +158,8 @@ class MediaPages(BasePage): total = len(self.unused_media_handles) idx = 1 - prev = sorted_media_handles[len(sorted_media_handles)-1] + total_m = len(sorted_media_handles) + prev = sorted_media_handles[total_m-1] if total_m > 0 else 0 if total > 0: for media_handle in self.unused_media_handles: media = self.r_db.get_media_from_handle(media_handle)