diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js index 45fde242dd..1156b1c379 100644 --- a/src/socket.io/modules.js +++ b/src/socket.io/modules.js @@ -71,6 +71,10 @@ SocketModules.composer.push = function(socket, pid, callback) { return callback(err); } + if (!results.topic) { + return callback(new Error('[[error:no-topic]]')); + } + callback(null, { pid: pid, body: postData.content, diff --git a/src/topics/posts.js b/src/topics/posts.js index 98c712341a..b6dc910005 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -248,6 +248,9 @@ module.exports = function(Topics) { Topics.getTopicDataByPid = function(pid, callback) { posts.getPostField(pid, 'tid', function(err, tid) { + if (err) { + return callback(err); + } Topics.getTopicData(tid, callback); }); };