From 14e9f5dd3c17178c6c983280fb22fc3ad65e55a6 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Sun, 17 Nov 2019 12:45:27 -0800 Subject: [PATCH] Fix #1421 (in a better way) Return empty set when ActiveClients is null This change ensures that SocketUser.ActiveClients will not return null, but instead an empty set by default. This can happen if the client has not recieved a presence update for a user, or if the user is not cached. --- src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs index d4798bedd..09c4165f4 100644 --- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs +++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs @@ -40,7 +40,7 @@ namespace Discord.WebSocket /// public UserStatus Status => Presence.Status; /// - public IImmutableSet ActiveClients => Presence.ActiveClients; + public IImmutableSet ActiveClients => Presence.ActiveClients ?? ImmutableHashSet.Empty; /// /// Gets mutual guilds shared with this user. ///