X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FUntrustPage.java;h=016359b58ee7ce97816d136ba8bb690bcf3a67d8;hb=53a71d1d6b91e4d56af49a06f2e06bc4d11bf3eb;hp=1ee4f8ee3d195774ea8b0bf6abc38d49e8acf96e;hpb=7f024734546973cd592e6cbf04604705477f15f6;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/UntrustPage.java b/src/main/java/net/pterodactylus/sone/web/UntrustPage.java index 1ee4f8e..016359b 100644 --- a/src/main/java/net/pterodactylus/sone/web/UntrustPage.java +++ b/src/main/java/net/pterodactylus/sone/web/UntrustPage.java @@ -17,6 +17,8 @@ package net.pterodactylus.sone.web; +import com.google.common.base.Optional; + import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.FreenetRequest; @@ -58,10 +60,10 @@ public class UntrustPage extends SoneTemplatePage { if (request.getMethod() == Method.POST) { String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); String identity = request.getHttpRequest().getPartAsStringFailsafe("sone", 44); - Sone currentSone = getCurrentSone(request.getToadletContext()); - Sone sone = webInterface.getCore().getSone(identity); - if (sone != null) { - webInterface.getCore().untrustSone(currentSone, sone); + Sone currentSone = getCurrentSone(request.getToadletContext()).get(); + Optional sone = webInterface.getCore().getSone(identity); + if (sone.isPresent()) { + webInterface.getCore().untrustSone(currentSone, sone.get()); } throw new RedirectException(returnPage); }