From c3f6503bec0a1b02d343194f22d99965f2f27b72 Mon Sep 17 00:00:00 2001 From: Cy Date: Sat, 30 May 2020 21:26:02 +0000 Subject: [PATCH] random exception when viewing notifications I think it's a rare occasion that there are no last seen notifications, in which case just ignoring it and setting account.note_seen later works fine. --- brutaldon/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/brutaldon/views.py b/brutaldon/views.py index 5249078..e9001f7 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -605,9 +605,12 @@ def note(request, next=None, prev=None): account, mastodon = get_usercontext(request) except NotLoggedInException: return redirect(about) - last_seen = mastodon.notifications(limit=1)[0] - account.note_seen = last_seen.id - account.save() + try: + last_seen = mastodon.notifications(limit=1)[0] + except IndexError: pass + else: + account.note_seen = last_seen.id + account.save() notes = mastodon.notifications(limit=40, max_id=next, min_id=prev) filters = get_filters(mastodon, context="notifications")