Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Fixed rare exception in OnPlayerLeft.
Browse files Browse the repository at this point in the history
  • Loading branch information
RequiDev committed Jun 19, 2022
1 parent c4daab4 commit eaaf12e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ReModCE/Components/InfoLogsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override void OnPlayerJoined(Player player)
public override void OnPlayerLeft(Player player)
{
if (!JoinLeaveLogsEnabled) return;
ReLogger.Msg(ConsoleColor.White, $"{player.field_Private_APIUser_0.displayName} left the instance.");
ReLogger.Msg(ConsoleColor.White, $"{player.field_Private_APIUser_0?.displayName ?? string.Empty} left the instance.");
}
}
}
3 changes: 3 additions & 0 deletions ReModCE/ReModCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ private static void OnPlayerJoined(Player player)

private static void OnPlayerLeft(Player player)
{
if (player == null)
return;

foreach (var m in Components)
{
m.OnPlayerLeft(player);
Expand Down

0 comments on commit eaaf12e

Please sign in to comment.