Don’t return null to function not allowing it
[Sone.git] / src / main / java / net / pterodactylus / sone / database / memory / MemoryPost.java
index 724c627..5c294c0 100644 (file)
@@ -30,8 +30,6 @@ import com.google.common.base.Optional;
 /**
  * A post is a short message that a user writes in his Sone to let other users
  * know what is going on.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
 class MemoryPost implements Post {
 
@@ -122,7 +120,7 @@ class MemoryPost implements Post {
         */
        @Override
        public Optional<Sone> getRecipient() {
-               return fromNullable(soneProvider.getSone(recipientId));
+               return recipientId == null ? Optional.<Sone>absent() : fromNullable(soneProvider.getSone(recipientId));
        }
 
        /**