X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2Fmemory%2FMemoryPost.java;h=30fc2b0c21fe3cba1aca5ff24b80e31c2e5203dd;hb=401388531d6cefbfb2029059b0ea270d7a470d2b;hp=d368fbaba373a6f1b7660892b473a710bfca034c;hpb=419098bcd6215125408b29e60bd888e60979d37b;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java
index d368fba..30fc2b0 100644
--- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java
+++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java
@@ -1,5 +1,5 @@
/*
- * Sone - MemoryPost.java - Copyright © 2010â2015 David Roden
+ * Sone - MemoryPost.java - Copyright © 2010â2019 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 David âBombeâ Roden
*/
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 getRecipientId() {
- return Optional.fromNullable(recipientId);
+ return fromNullable(recipientId);
}
/**
@@ -120,7 +120,7 @@ class MemoryPost implements Post {
*/
@Override
public Optional getRecipient() {
- return soneProvider.getSone(recipientId);
+ return recipientId == null ? Optional.absent() : fromNullable(soneProvider.getSone(recipientId));
}
/**