crash in narrative web if no unused media (#549)

This commit is contained in:
Serge Noiraud 2018-02-16 19:20:02 +01:00 committed by GitHub
parent db263ff905
commit 1e5a6e1f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)