From dd40cbc139b8bc1f02d2d2d1b88e134b9ebd20e4 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 24 Aug 2013 18:51:24 -0400 Subject: [PATCH] check if topicData is valid --- src/webserver.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webserver.js b/src/webserver.js index 5ddb6b3302..0738f8b616 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -224,8 +224,10 @@ var express = require('express'), async.waterfall([ function(next) { topics.getTopicWithPosts(tid, ((req.user) ? req.user.uid : 0), function(err, topicData) { - if(topicData.deleted === '1' && topicData.expose_tools === 0) - return next(new Error('Topic deleted'), null); + if(topicData) { + if(topicData.deleted === '1' && topicData.expose_tools === 0) + return next(new Error('Topic deleted'), null); + } next(err, topicData); });