From 652e1ef5745b69cb15e756eeb7df923af6e47388 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 29 May 2014 12:09:54 -0400 Subject: [PATCH] closes #1597 turns out clicking back causes double script.init() calls and ajaxify.variables.get('topic_id') can be undefined in one of those calls. --- public/src/forum/topic.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 4337937a99..532526763e 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -376,7 +376,8 @@ define(['forum/pagination', 'forum/infinitescroll', 'forum/topic/threadTools', ' } function loadPostsAfter(after, callback) { - if (!utils.isNumber(after) || (after === 0 && $('#post-container li.post-row[data-index="0"]').length)) { + var tid = ajaxify.variables.get('topic_id'); + if (!utils.isNumber(tid) || !utils.isNumber(after) || (after === 0 && $('#post-container li.post-row[data-index="0"]').length)) { return; } @@ -386,7 +387,7 @@ define(['forum/pagination', 'forum/infinitescroll', 'forum/topic/threadTools', ' } infinitescroll.loadMore('topics.loadMore', { - tid: ajaxify.variables.get('topic_id'), + tid: tid, after: after }, function (data) {