Fix annotations and possible NPEs
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 9 Jun 2016 05:19:28 +0000 (07:19 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 9 Jun 2016 05:19:28 +0000 (07:19 +0200)
src/main/java/net/pterodactylus/sone/notify/PostVisibilityFilter.java
src/main/java/net/pterodactylus/sone/notify/ReplyVisibilityFilter.java

index edcd148..3582e3d 100644 (file)
@@ -87,10 +87,9 @@ public class PostVisibilityFilter {
        @Nonnull
        public Predicate<Post> isVisible(@Nullable final Sone currentSone) {
                return new Predicate<Post>() {
-                       @Nonnull
                        @Override
                        public boolean apply(@Nullable Post post) {
-                               return isPostVisible(currentSone, post);
+                               return (post != null) && isPostVisible(currentSone, post);
                        }
                };
        }
index a76ae25..fd13779 100644 (file)
@@ -62,10 +62,9 @@ public class ReplyVisibilityFilter {
        @Nonnull
        public Predicate<PostReply> isVisible(@Nullable final Sone currentSone) {
                return new Predicate<PostReply>() {
-                       @Nonnull
                        @Override
                        public boolean apply(@Nullable PostReply postReply) {
-                               return isReplyVisible(currentSone, postReply);
+                               return (postReply != null) && isReplyVisible(currentSone, postReply);
                        }
                };
        }