From c4b7f78d450ada03593ec6a21a7210e968d765ae Mon Sep 17 00:00:00 2001 From: RogueException Date: Thu, 11 Feb 2016 17:54:21 -0400 Subject: [PATCH] Dont nullref if SetStatus/SetGame are called during a disconnected state --- src/Discord.Net/DiscordClient.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs index 8ed7022eb..2aa3533ea 100644 --- a/src/Discord.Net/DiscordClient.cs +++ b/src/Discord.Net/DiscordClient.cs @@ -315,7 +315,9 @@ namespace Discord current.CurrentGame = CurrentGame; } } - GatewaySocket.SendUpdateStatus(Status == UserStatus.Idle ? EpochTime.GetMilliseconds() - (10 * 60 * 1000) : (long?)null, CurrentGame); + var socket = GatewaySocket; + if (socket != null) + socket.SendUpdateStatus(Status == UserStatus.Idle ? EpochTime.GetMilliseconds() - (10 * 60 * 1000) : (long?)null, CurrentGame); } #region Channels