fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-07 04:12 am

[dw-free] Filter to entry sometimes breaks

[commit: http://hg.dwscoalition.org/dw-free/rev/edc95acb4e6a]

http://bugs.dwscoalition.org/show_bug.cgi?id=2668

Add some error checking in case an entry or comment was deleted.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/NotificationInbox.pm
--------------------------------------------------------------------------------
diff -r 7a62622d9127 -r edc95acb4e6a cgi-bin/LJ/NotificationInbox.pm
--- a/cgi-bin/LJ/NotificationInbox.pm	Mon Jun 07 03:03:52 2010 +0000
+++ b/cgi-bin/LJ/NotificationInbox.pm	Mon Jun 07 12:18:28 2010 +0800
@@ -178,7 +178,12 @@ sub subset_items {
 
 sub singleentry_items {
     my ( $self, $itemid ) = @_;
-    return grep { $_->event->class eq "LJ::Event::JournalNewComment" && $_->event->comment->entry->ditemid == $itemid } $self->items;
+    return grep {
+        $_->event->class eq "LJ::Event::JournalNewComment"
+        && $_->event->comment
+        && $_->event->comment->entry    # may have been deleted, which breaks all filter to entry comments
+        && $_->event->comment->entry->ditemid == $itemid
+    } $self->items;
 }
 
 # return flagged notifications
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org