From e1808804c915c55e33c747057c7b7ea4efcbbe62 Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Tue, 17 May 2016 22:31:35 -0700 Subject: [PATCH] serverMemberUpdated clarification and crash fix --- docs/docs_client.rst | 2 +- lib/Client/InternalClient.js | 2 +- src/Client/InternalClient.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs_client.rst b/docs/docs_client.rst index 43a557851..bbcff89de 100644 --- a/docs/docs_client.rst +++ b/docs/docs_client.rst @@ -869,7 +869,7 @@ Emitted when a member is removed from a server. Supplies a Server_ object and a serverMemberUpdated ~~~~~~~~~~~~~~~~~~~ -Emitted when a member in a server is updated. Supplies a Server_ object and 2 User_ objects, the first being the new, updated user, the second being the old one. +Emitted when a member in a server is updated. Supplies a Server_ object and 2 User_ objects, the first being the new, updated user, the second being the old one. The old user object could be null if the bot didn't previously have the member cached. presence ~~~~~~~~ diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index d106b24b9..c170286e2 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -2252,7 +2252,7 @@ var InternalClient = (function () { // only for detecting self user movements for connections. var connection = self.voiceConnections.get("server", server); // existing connection, perhaps channel moved - if (connection && connection.voiceChannel.id !== data.channel_id) { + if (connection && connection.voiceChannel && connection.voiceChannel.id !== data.channel_id) { // moved, update info connection.voiceChannel = self.channels.get("id", data.channel_id); client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 89da4fe43..2e4cf9954 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -1957,7 +1957,7 @@ export default class InternalClient { if (user && user.id === self.user.id) { // only for detecting self user movements for connections. var connection = self.voiceConnections.get("server", server); // existing connection, perhaps channel moved - if (connection && connection.voiceChannel.id !== data.channel_id) { + if (connection && connection.voiceChannel && connection.voiceChannel.id !== data.channel_id) { // moved, update info connection.voiceChannel = self.channels.get("id", data.channel_id); client.emit("voiceMoved", connection.voiceChannel); // Moved to a new channel