From 08fbb88535d0804680dff1e51f8754b0e1e9669f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 4 Nov 2010 06:56:45 +0100 Subject: [PATCH] Always return a Post. --- src/main/java/net/pterodactylus/sone/core/Core.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } } -- 2.7.4