Return an optional Sone from the current session.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / UnlikeAjaxPage.java
index 17be966..b1ab9e0 100644 (file)
@@ -49,10 +49,7 @@ public class UnlikeAjaxPage extends JsonPage {
                if ((id == null) || (id.length() == 0)) {
                        return createErrorJsonObject("invalid-" + type + "-id");
                }
-               Sone currentSone = getCurrentSone(request.getToadletContext());
-               if (currentSone == null) {
-                       return createErrorJsonObject("auth-required");
-               }
+               Sone currentSone = getCurrentSone(request.getToadletContext()).get();
                if ("post".equals(type)) {
                        currentSone.removeLikedPostId(id);
                        webInterface.getCore().touchConfiguration();