From 40f9ee3003072d987cf01c3cf2ce7284e35e388a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 24 Oct 2018 17:41:06 -0400 Subject: [PATCH] dont crash if topic does not exist --- src/socket.io/topics/tools.js | 3 +++ 1 file changed, 3 insertions(+) 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);