Skip to content

Commit a3cfa65

Browse files
Merge pull request #3 from CSGALS/invalid-handle-bug
Fixed an invalid handle access
2 parents 5c7ec1d + 265efa5 commit a3cfa65

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/SharpModMenu/PlayerExtensions.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal static class PlayerExtensions
3232
{
3333
public static ObserverInfo GetObserverInfo(this CCSPlayerController player)
3434
{
35-
if (player.Pawn.Value is not CBasePlayerPawn pawn)
35+
if (!player.Pawn.IsValid || player.Pawn.Value is not CBasePlayerPawn pawn)
3636
return new() { Mode = ObserverMode.Roaming, Observing = null };
3737

3838
if (pawn.ObserverServices is not CPlayer_ObserverServices observerServices)

‎src/SharpModMenu/PlayerMenuState.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public void Refresh(bool sortPriorities = true)
195195
public void Dispose()
196196
{
197197
DestroyEntities();
198+
MenuActive = false; // force the removal of this menu from the active menus
198199
}
199200

200201
private CPointWorldText? HighlightText { get; set; }

0 commit comments

Comments
 (0)