X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FCreateReplyPage.java;h=3ec13f6bfe6f6982b63d62ff4a7dbad320835525;hp=4158313201c3ca65297d13cf33b7d3d9a1aa2eba;hb=fd88107b013522d7620f5297386472206f320e10;hpb=d063d7366c883a8f130de67af67a84eb6d725361 diff --git a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java index 4158313..3ec13f6 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java @@ -19,8 +19,8 @@ package net.pterodactylus.sone.web; import com.google.common.base.Optional; +import net.pterodactylus.sone.data.LocalSone; import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.text.TextFilter; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; @@ -66,12 +66,12 @@ public class CreateReplyPage extends SoneTemplatePage { } if (text.length() > 0) { String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43); - Sone sender = webInterface.getCore().getLocalSone(senderId); - if (sender == null) { - sender = getCurrentSone(request.getToadletContext()).get(); + Optional sender = webInterface.getCore().getLocalSone(senderId); + if (!sender.isPresent()) { + sender = getCurrentSone(request.getToadletContext()); } text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text); - webInterface.getCore().createReply(sender, post.get(), text); + webInterface.getCore().createReply(sender.get(), post.get(), text); throw new RedirectException(returnPage); } templateContext.set("errorTextEmpty", true);