Only list replies whose posts exist.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 25 Jan 2013 17:19:33 +0000 (18:19 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 25 Jan 2013 17:19:33 +0000 (18:19 +0100)
src/main/java/net/pterodactylus/sone/web/NewPage.java

index 22d27c8..71200d8 100644 (file)
@@ -23,6 +23,8 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import com.google.common.collect.Collections2;
+
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.notify.ListNotificationFilters;
@@ -66,7 +68,7 @@ public class NewPage extends SoneTemplatePage {
 
                /* collect new elements from notifications. */
                Set<Post> posts = new HashSet<Post>(webInterface.getNewPosts());
-               for (PostReply reply : webInterface.getNewReplies()) {
+               for (PostReply reply : Collections2.filter(webInterface.getNewReplies(), PostReply.HAS_POST_FILTER)) {
                        posts.add(reply.getPost().get());
                }