Skip to content

Commit

Permalink
fix: NRE when changing item
Browse files Browse the repository at this point in the history
  • Loading branch information
BoltonDev committed Jun 4, 2024
1 parent ebe06c5 commit b00fb77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Exiled.CustomModules/EventHandlers/PlayerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void OnChangingItem(ChangingItemEventArgs ev)

if (CustomItem.TryGet(ev.Item, out CustomItem customItem) && customItem.Settings.Cast<ItemSettings>().ShouldMessageOnGban)
SpectatorCustomNickname(ev.Player, $"{ev.Player.CustomName} (CustomItem: {customItem.Name})");
else if (ev.Player && ev.Player.Cast<Pawn>().CurrentCustomItem)
else if (ev.Player && ev.Player.Cast(out Pawn pawn) && pawn.CurrentItem)
SpectatorCustomNickname(ev.Player, ev.Player.HasCustomName ? ev.Player.CustomName : string.Empty);
}

Expand Down

0 comments on commit b00fb77

Please sign in to comment.