fix crash when you go to /topics/nonexistant

This commit is contained in:
Baris Usakli
2013-05-16 12:13:39 -04:00
parent 9d5f6364ad
commit 34432773d6
4 changed files with 39 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ marked.setOptions({
(function(Posts) {
Posts.get = function(callback, tid, current_user, start, end) {
if (start == null) start = 0;
if (end == null) end = start + 10;
@@ -74,6 +75,11 @@ marked.setOptions({
// get all data for thread in asynchronous fashion
RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) {
RDB.handle(err);
if(pids.length === 0){
callback(false);
return;
}
var content = [], uid = [], timestamp = [], pid = [], post_rep = [], editor = [], editTime = [], deleted = [];