From: David ‘Bombe’ Roden Date: Thu, 4 Nov 2010 05:56:45 +0000 (+0100) Subject: Always return a Post. X-Git-Tag: 0.2-RC1~55 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=08fbb88535d0804680dff1e51f8754b0e1e9669f;p=Sone.git Always return a Post. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index cc60b90..28ef2d7 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -292,7 +292,12 @@ public class Core implements IdentityListener { */ public Post getPost(String postId) { synchronized (posts) { - return posts.get(postId); + Post post = posts.get(postId); + if (post == null) { + post = new Post(postId); + posts.put(postId, post); + } + return post; } }