Check that socket.mcbot exists before grabbing its entity

This commit is contained in:
AlexKvazos
2015-05-04 12:59:54 -05:00
parent 30954588e5
commit cab42eebc5
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = (socket) => {
socket.emit('buffer:error', error);
// if the bot is logged in and/or is an entity, destroy it
if (socket.mcbot.entity) socket.mcbot.end();
if (socket.mcbot && socket.mcbot.entity) socket.mcbot.end();
// delete the bot
delete socket.mcbot;