From: David ‘Bombe’ Roden Date: Sat, 26 Jan 2013 10:41:18 +0000 (+0100) Subject: Don’t call Optional.get() on potentially non-existing instance. X-Git-Tag: 0.8.5^2~3^2~46 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=1a31c9d080f15faa3d762275f08d124435c7621a;p=Sone.git Don’t call Optional.get() on potentially non-existing instance. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java index 50719ee..8adf46d 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java @@ -75,7 +75,7 @@ public class ViewPostPage extends SoneTemplatePage { String postId = request.getHttpRequest().getParam("post"); boolean raw = request.getHttpRequest().getParam("raw").equals("true"); Optional post = webInterface.getCore().getPost(postId); - templateContext.set("post", post.get()); + templateContext.set("post", post.orNull()); templateContext.set("raw", raw); }