Skip to content

Commit

Permalink
Null checks to destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed May 21, 2024
1 parent db7743c commit 65d448a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Fika.Core/Coop/Players/CoopBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ private IEnumerator DestroyNetworkedComponents()
{
yield return new WaitForSeconds(2);

PacketSender.DestroyThis();
if (PacketSender != null)
{
PacketSender.DestroyThis();
}
}

public override void UpdateTick()
Expand Down
10 changes: 8 additions & 2 deletions Fika.Core/Coop/Players/CoopPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,10 @@ private IEnumerator DestroyNetworkedComponents()
{
yield return new WaitForSeconds(2);

PacketSender.DestroyThis();
if (PacketSender != null)
{
PacketSender.DestroyThis();
}
}

public override void Move(Vector2 direction)
Expand Down Expand Up @@ -1342,7 +1345,10 @@ public override void OnDestroy()
public override void Dispose()
{
base.Dispose();
PacketSender.DestroyThis();
if (PacketSender != null)
{
PacketSender.DestroyThis();
}
}

public override void SendHandsInteractionStateChanged(bool value, int animationId)
Expand Down

0 comments on commit 65d448a

Please sign in to comment.