diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6 index c4a4a4e7fcf..5a769dd5274 100644 --- a/app/assets/javascripts/discourse/components/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6 @@ -134,7 +134,9 @@ export default Ember.Component.extend({ isDocked = offset >= threshold - windowHeight + topicProgressHeight + composerHeight; } - const dockPos = $(document).height() - $('#topic-footer-main-buttons').offset().top - topicProgressHeight; + const $mainButtons = $('#topic-footer-main-buttons'); + const mainPos = $mainButtons.length > 0 ? $mainButtons.offset().top : 0; + const dockPos = $(document).height() - mainPos - topicProgressHeight; if (composerHeight > 0) { if (isDocked) { diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 5e6b0d3d8e7..0a56160bbcb 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -870,7 +870,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, { } const max = _.max(postNumbers); - if (max > topic.get("last_read_post_number")) { + if (max > (topic.get("last_read_post_number") || 0)) { topic.set("last_read_post_number", max); }