diff --git a/app/assets/javascripts/discourse/models/post_stream.js b/app/assets/javascripts/discourse/models/post_stream.js index 0a38c5c8d..54d9b3e94 100644 --- a/app/assets/javascripts/discourse/models/post_stream.js +++ b/app/assets/javascripts/discourse/models/post_stream.js @@ -686,6 +686,9 @@ Discourse.PostStream = Em.Object.extend({ @returns {Discourse.Post} the post from the identity map **/ storePost: function(post) { + // Calling `Em.get(undefined` raises an error + if (!post) { return; } + var postId = Em.get(post, 'id'); if (postId) { var postIdentityMap = this.get('postIdentityMap'), @@ -745,7 +748,7 @@ Discourse.PostStream = Em.Object.extend({ return this.loadIntoIdentityMap(unloaded).then(function() { return postIds.map(function (p) { return postIdentityMap.get(p); - }); + }).compact(); }); },