Merge pull request #2247 from bradx3/fix_null_topic_error

BUGFIX: suppress error when scrolling at bottom of topic
This commit is contained in:
Sam 2014-04-10 16:33:01 +10:00
commit 49386412ca

View file

@ -558,6 +558,8 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
@params {Discourse.Post} post that is at the top @params {Discourse.Post} post that is at the top
**/ **/
topVisibleChanged: function(post) { topVisibleChanged: function(post) {
if (!post) { return; }
var postStream = this.get('postStream'), var postStream = this.get('postStream'),
firstLoadedPost = postStream.get('firstLoadedPost'); firstLoadedPost = postStream.get('firstLoadedPost');
@ -589,6 +591,8 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
@params {Discourse.Post} post that is at the bottom @params {Discourse.Post} post that is at the bottom
**/ **/
bottomVisibleChanged: function(post) { bottomVisibleChanged: function(post) {
if (!post) { return; }
var postStream = this.get('postStream'), var postStream = this.get('postStream'),
lastLoadedPost = postStream.get('lastLoadedPost'), lastLoadedPost = postStream.get('lastLoadedPost'),
index = postStream.get('stream').indexOf(post.get('id'))+1; index = postStream.get('stream').indexOf(post.get('id'))+1;