Skip to content

Node.js based forum software built for the modern web

default for missing post_index parameter

Moritz Schmidtd1273516b54f
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index bfc2b4e396..f710e1119d 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -72,7 +72,7 @@ topicsController.get = function(req, res, next) {
postIndex = Math.max((req.params.post_index || 1) - (settings.postsPerPage + 1), 0);
}
} else if (!req.query.page) {
- var index = Math.max(parseInt(req.params.post_index, 10), 0);
+ var index = Math.max(parseInt(req.params.post_index, 10), 0) || 0;
page = Math.ceil((index + 1) / settings.postsPerPage);
}