📄 Update year in file headers
[Sone.git] / src / main / java / net / pterodactylus / sone / database / memory / MemoryPost.java
index acf2374..451b6b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - MemoryPost.java - Copyright Â© 2010–2016 David Roden
+ * Sone - MemoryPost.java - Copyright Â© 2010–2020 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
 
 package net.pterodactylus.sone.database.memory;
 
+import static com.google.common.base.Optional.fromNullable;
+
 import java.util.UUID;
 
 import net.pterodactylus.sone.data.Post;
@@ -28,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 {
 
@@ -104,7 +104,7 @@ class MemoryPost implements Post {
         */
        @Override
        public Sone getSone() {
-               return soneProvider.getSone(soneId).get();
+               return soneProvider.getSone(soneId);
        }
 
        /**
@@ -112,7 +112,7 @@ class MemoryPost implements Post {
         */
        @Override
        public Optional<String> getRecipientId() {
-               return Optional.fromNullable(recipientId);
+               return fromNullable(recipientId);
        }
 
        /**
@@ -120,7 +120,7 @@ class MemoryPost implements Post {
         */
        @Override
        public Optional<Sone> getRecipient() {
-               return soneProvider.getSone(recipientId);
+               return recipientId == null ? Optional.<Sone>absent() : fromNullable(soneProvider.getSone(recipientId));
        }
 
        /**