Skip to content

Node.js based forum software built for the modern web

crash fix

barisusakliba32a4dc4f10
diff --git a/src/categories.js b/src/categories.js
index 8043401830..aaf732151b 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -414,7 +414,11 @@ var db = require('./database'),
Categories.onNewPostMade = function(postData) {
topics.getTopicFields(postData.tid, ['cid', 'pinned'], function(err, topicData) {
if (err) {
- winston.error(err.message);
+ return winston.error(err.message);
+ }
+
+ if (!topicData) {
+ return;
}
var cid = topicData.cid;