From 629e6f41580cb76f0d627e1cb03a870580053df2 Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Thu, 10 Apr 2014 15:36:44 +1000 Subject: [PATCH] BUGFIX: suppress error when scrolling at bottom of topic fixes "Uncaught TypeError: Cannot call method 'get' of null" when scrolling at the bottom of the topic screen. --- .../javascripts/discourse/controllers/topic_controller.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/javascripts/discourse/controllers/topic_controller.js b/app/assets/javascripts/discourse/controllers/topic_controller.js index be847a135..1361ba81d 100644 --- a/app/assets/javascripts/discourse/controllers/topic_controller.js +++ b/app/assets/javascripts/discourse/controllers/topic_controller.js @@ -558,6 +558,8 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected @params {Discourse.Post} post that is at the top **/ topVisibleChanged: function(post) { + if (!post) { return; } + var postStream = this.get('postStream'), firstLoadedPost = postStream.get('firstLoadedPost'); @@ -589,6 +591,8 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected @params {Discourse.Post} post that is at the bottom **/ bottomVisibleChanged: function(post) { + if (!post) { return; } + var postStream = this.get('postStream'), lastLoadedPost = postStream.get('lastLoadedPost'), index = postStream.get('stream').indexOf(post.get('id'))+1;