Always return a Post.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Nov 2010 05:56:45 +0000 (06:56 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Nov 2010 05:56:45 +0000 (06:56 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index cc60b90..28ef2d7 100644 (file)
@@ -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;
                }
        }