Skip to content

Node.js based forum software built for the modern web

dont crash if topic does not exist

Barış Soner Uşaklı40f9ee300307
diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.js
index 4c133d1d4e..de35f9e635 100644
--- a/src/socket.io/topics/tools.js
+++ b/src/socket.io/topics/tools.js
@@ -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);