Skip to content

Commit

Permalink
Check validitiy
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Feb 3, 2024
1 parent 41562ef commit 612482c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mod/Jailbreak.Teams/Queue/QueueBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void ForceGuard(CCSPlayerController player)
/// <returns></returns>
public HookResult OnRequestToJoinTeam(CCSPlayerController? invoked, CommandInfo command)
{
if (invoked == null)
if (invoked == null || !invoked.IsValid)
return HookResult.Continue;

var state = _state.Get(invoked);
Expand Down Expand Up @@ -173,8 +173,11 @@ public HookResult OnRequestToJoinTeam(CCSPlayerController? invoked, CommandInfo
[GameEventHandler]
public HookResult OnPlayerSpawn(EventPlayerSpawn ev, GameEventInfo info)
{
var state = _state.Get(ev.Userid);
var player = ev.Userid;
if (!player.IsValid)
return HookResult.Continue;

var state = _state.Get(ev.Userid);

if (player.GetTeam() == CsTeam.CounterTerrorist && !state.IsGuard)
{
Expand Down

0 comments on commit 612482c

Please sign in to comment.