diff --git a/src/SharpModMenu/PlayerExtensions.cs b/src/SharpModMenu/PlayerExtensions.cs index 9e18eb2..d5072b1 100644 --- a/src/SharpModMenu/PlayerExtensions.cs +++ b/src/SharpModMenu/PlayerExtensions.cs @@ -32,7 +32,7 @@ internal static class PlayerExtensions { public static ObserverInfo GetObserverInfo(this CCSPlayerController player) { - if (player.Pawn.Value is not CBasePlayerPawn pawn) + if (!player.Pawn.IsValid || player.Pawn.Value is not CBasePlayerPawn pawn) return new() { Mode = ObserverMode.Roaming, Observing = null }; if (pawn.ObserverServices is not CPlayer_ObserverServices observerServices) diff --git a/src/SharpModMenu/PlayerMenuState.cs b/src/SharpModMenu/PlayerMenuState.cs index 96ab308..8f76c18 100644 --- a/src/SharpModMenu/PlayerMenuState.cs +++ b/src/SharpModMenu/PlayerMenuState.cs @@ -195,6 +195,7 @@ public void Refresh(bool sortPriorities = true) public void Dispose() { DestroyEntities(); + MenuActive = false; // force the removal of this menu from the active menus } private CPointWorldText? HighlightText { get; set; }