X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FFollowSonePage.java;h=eef94dfb4b00db377383a626f9451053dae5b566;hb=c4ae226ec5052116cefc542ae2017036a7bc6332;hp=4083b9985eb34e414109c722c806697f88648c97;hpb=bb34588a1b7a80a2a98574d9b928f1131ab88a79;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java index 4083b99..eef94df 100644 --- a/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/FollowSonePage.java @@ -1,5 +1,5 @@ /* - * Sone - FollowSonePage.java - Copyright © 2010 David Roden + * Sone - FollowSonePage.java - Copyright © 2010–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.data.Sone; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; @@ -55,9 +57,10 @@ public class FollowSonePage extends SoneTemplatePage { Sone currentSone = getCurrentSone(request.getToadletContext()); String soneIds = request.getHttpRequest().getPartAsStringFailsafe("sone", 1200); for (String soneId : soneIds.split("[ ,]+")) { - if (webInterface.getCore().hasSone(soneId)) { + Optional sone = webInterface.getCore().getSone(soneId); + if (sone.isPresent()) { webInterface.getCore().followSone(currentSone, soneId); - webInterface.getCore().markSoneKnown(webInterface.getCore().getSone(soneId)); + webInterface.getCore().markSoneKnown(sone.get()); } } throw new RedirectException(returnPage);