From c94447fec558dfdb6867b38cd651945375787b19 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 23:31:43 +0000 Subject: [PATCH] Add null checks for social status updates --- GenOnlineService/Constants.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GenOnlineService/Constants.cs b/GenOnlineService/Constants.cs index 4792910..b96ed74 100644 --- a/GenOnlineService/Constants.cs +++ b/GenOnlineService/Constants.cs @@ -325,9 +325,11 @@ public static async Task DeleteSession(Int64 user_id, UserWebSocketInstance? old { // TODO_SOCIAL: Move this to a class // inform any friends who are online that this person just came online + if (sourceData != null) + { WebSocketMessage_Social_FriendStatusChanged friendStatusChangedEvent = new(); friendStatusChangedEvent.msg_id = (int)EWebSocketMessageID.SOCIAL_FRIEND_ONLINE_STATUS_CHANGED; - friendStatusChangedEvent.display_name = sourceData.m_strDisplayName; + friendStatusChangedEvent.display_name = sourceData?.m_strDisplayName; friendStatusChangedEvent.online = false; byte[] bytesJSON = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(friendStatusChangedEvent)); @@ -812,7 +814,9 @@ public UserWebSocketInstance(Int64 ownerID, string strDisplayName, UserSocialCon // TODO_SOCIAL: Move this to a class // inform any friends who are online that this person just came online - WebSocketMessage_Social_FriendStatusChanged friendStatusChangedEvent = new(); + if (sourceData != null) + { + WebSocketMessage_Social_FriendStatusChanged friendStatusChangedEvent = new(); friendStatusChangedEvent.msg_id = (int)EWebSocketMessageID.SOCIAL_FRIEND_ONLINE_STATUS_CHANGED; friendStatusChangedEvent.display_name = strDisplayName; friendStatusChangedEvent.online = true;