X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;h=f2ca0c55c5e5fe24a3004dc23cdeaa0ebbb10478;hp=9aacff6f610351680bdefbb443b41fa2d3a71cd3;hb=8f02544d31f323ae9053dd9a11a99eacd8cf5bcd;hpb=4acdae8d247379dedcc5d41c8aded9503fcbaf72 diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 9aacff6..f2ca0c5 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -32,6 +32,9 @@ import net.pterodactylus.sone.database.PostProvider; import net.pterodactylus.sone.database.SoneProvider; import net.pterodactylus.util.io.Closer; import net.pterodactylus.util.logging.Logging; + +import com.google.common.base.Optional; + import freenet.keys.FreenetURI; /** @@ -258,9 +261,9 @@ public class SoneTextParser implements Parser { if (linkType == LinkType.POST) { if (line.length() >= (7 + 36)) { String postId = line.substring(7, 43); - Post post = postProvider.getPost(postId); - if ((post != null) && (post.getSone() != null)) { - parts.add(new PostPart(post)); + Optional post = postProvider.getPost(postId); + if (post.isPresent()) { + parts.add(new PostPart(post.get())); } else { parts.add(new PlainTextPart(line.substring(0, 43))); }