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