diff options
author | Andrew Browning <ayleph@thisshitistemp.com> | 2016-03-02 12:29:33 -0500 |
---|---|---|
committer | Andrew Browning <ayleph@thisshitistemp.com> | 2016-03-02 12:31:55 -0500 |
commit | 289826dc46b0399ff993a53ac85545e5096b0dc7 (patch) | |
tree | a0f7de0ee5ba90ad36a8c9a9f73422a85a1bb336 /mediagoblin/notifications | |
parent | 161bc6b2c18f2d20eb759725b2df7fc7ac4a2728 (diff) | |
download | mediagoblin-289826dc46b0399ff993a53ac85545e5096b0dc7.tar.lz mediagoblin-289826dc46b0399ff993a53ac85545e5096b0dc7.tar.xz mediagoblin-289826dc46b0399ff993a53ac85545e5096b0dc7.zip |
Fix #5435 - Bad comment links cause server error
This patch addresses an issue where a server error is caused by
entering a non-existent comment ID in a media URL.
Diffstat (limited to 'mediagoblin/notifications')
-rw-r--r-- | mediagoblin/notifications/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mediagoblin/notifications/__init__.py b/mediagoblin/notifications/__init__.py index 9d2f2b78..d554de2d 100644 --- a/mediagoblin/notifications/__init__.py +++ b/mediagoblin/notifications/__init__.py @@ -71,6 +71,11 @@ def mark_notification_seen(notification): def mark_comment_notification_seen(comment_id, user): comment = Comment.query.get(comment_id) + + # If there is no comment, there is no notification + if comment == None: + return + comment_gmr = GenericModelReference.query.filter_by( obj_pk=comment.id, model_type=comment.__tablename__ |