X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FAbstractSoneCommand.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FAbstractSoneCommand.java;h=9942af71c0d57b1713d07db147117e15d5c38076;hp=a47bde3f4dbd57a732c7d508ada301301d57c7e9;hb=fd32e307db87c617a4c455f592b6e649ec50ae8a;hpb=ff4bc3606b33e9796ff4fbae087b4224d02cf0d0 diff --git a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java index a47bde3..9942af7 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java @@ -184,11 +184,11 @@ public abstract class AbstractSoneCommand extends AbstractCommand { protected Post getPost(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException { try { String postId = simpleFieldSet.getString(parameterName); - Optional post = core.getPost(postId); - if (!post.isPresent()) { + Post post = core.getPost(postId); + if (post == null) { throw new FcpException("Could not load post from “" + postId + "”."); } - return post.get(); + return post; } catch (FSParseException fspe1) { throw new FcpException("Could not post ID from “" + parameterName + "”.", fspe1); }