dont crash if topic does not exist

This commit is contained in:
Barış Soner Uşaklı
2018-10-24 17:41:06 -04:00
parent 56c1eac1a5
commit 40f9ee3003

View File

@@ -29,6 +29,9 @@ module.exports = function (SocketTopics) {
}, next);
},
function (results, next) {
if (!results.topic) {
return next(new Error('[[error:no-topic]]'))
}
topic = results.topic;
topic.privileges = results.privileges;
plugins.fireHook('filter:topic.thread_tools', { topic: results.topic, uid: socket.uid, tools: [] }, next);