X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FDistrustPage.java;h=c8879a0e7ff9d0b7f50d62c278cfb51af1a286f4;hp=262d60254c9a2598f9a32c10c73f53f49757280f;hb=45803a1c678d6811f7bbf85d50c79844031be0f0;hpb=33cc85447797301e299e7ac444fe53538f09a69d diff --git a/src/main/java/net/pterodactylus/sone/web/DistrustPage.java b/src/main/java/net/pterodactylus/sone/web/DistrustPage.java index 262d602..c8879a0 100644 --- a/src/main/java/net/pterodactylus/sone/web/DistrustPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DistrustPage.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; @@ -59,9 +61,9 @@ public class DistrustPage extends SoneTemplatePage { 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().distrustSone(currentSone, sone); + Optional sone = webInterface.getCore().getSone(identity); + if (sone.isPresent()) { + webInterface.getCore().distrustSone(currentSone, sone.get()); } throw new RedirectException(returnPage); }