X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FUnlockSonePage.java;h=314a8c0b9a3fd0928d419a1e4e8d2da9efc3e66a;hp=ed92246061a51a6e2448add1e82d1353fccc18dc;hb=2f995a29d8731dc3b3d20e78fd9382be542292ff;hpb=19632b7bb999f888668bdb6d8bdfe0572002b8e4 diff --git a/src/main/java/net/pterodactylus/sone/web/UnlockSonePage.java b/src/main/java/net/pterodactylus/sone/web/UnlockSonePage.java index ed92246..314a8c0 100644 --- a/src/main/java/net/pterodactylus/sone/web/UnlockSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/UnlockSonePage.java @@ -22,6 +22,8 @@ import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; +import com.google.common.base.Optional; + /** * This page lets the user unlock a {@link Sone} to allow its insertion. * @@ -52,9 +54,9 @@ public class UnlockSonePage extends SoneTemplatePage { protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44); - Sone sone = webInterface.getCore().getLocalSone(soneId, false); - if (sone != null) { - webInterface.getCore().unlockSone(sone); + Optional sone = webInterface.getCore().getLocalSone(soneId); + if (sone.isPresent()) { + webInterface.getCore().unlockSone(sone.get()); } String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); throw new RedirectException(returnPage);