X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FUntrustPage.java;h=9d5127683cfe26ef70818377e7a915ee89879ce7;hb=c4ae226ec5052116cefc542ae2017036a7bc6332;hp=1ee4f8ee3d195774ea8b0bf6abc38d49e8acf96e;hpb=8f02544d31f323ae9053dd9a11a99eacd8cf5bcd;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..9d51276 100644 --- a/src/main/java/net/pterodactylus/sone/web/UntrustPage.java +++ b/src/main/java/net/pterodactylus/sone/web/UntrustPage.java @@ -1,5 +1,5 @@ /* - * Sone - UntrustPage.java - Copyright © 2011–2013 David Roden + * Sone - UntrustPage.java - Copyright © 2011–2016 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.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 UntrustPage 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().untrustSone(currentSone, sone); + Optional sone = webInterface.getCore().getSone(identity); + if (sone.isPresent()) { + webInterface.getCore().untrustSone(currentSone, sone.get()); } throw new RedirectException(returnPage); }