From 3ff4e3d5066da6db2734be704433983071f6ffa6 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Sat, 23 Nov 2019 09:58:13 -0800 Subject: [PATCH] fix: #1421 (in a better way) Return empty set when ActiveClients is null (#1422) 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. ///