From f67aec4ace1c6728355b28b972980cd543162129 Mon Sep 17 00:00:00 2001 From: Nereziel Date: Wed, 8 Nov 2023 14:54:20 +0100 Subject: [PATCH] should fix crash #6 --- WeaponPaints.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/WeaponPaints.cs b/WeaponPaints.cs index e1bcf6b4..2ff9d54f 100644 --- a/WeaponPaints.cs +++ b/WeaponPaints.cs @@ -46,7 +46,7 @@ public class WeaponPaints : BasePlugin var weapon = new CBasePlayerWeapon(entity.Handle); Server.NextFrame(() => { - if (!weapon.IsValid) return; + if (!weapon.IsValid || !weapon.OwnerEntity.IsValid) return; var pawn = new CBasePlayerPawn(NativeAPI.GetEntityFromIndex((int)weapon.OwnerEntity.Value.EntityIndex!.Value.Value)); if (!pawn.IsValid) return; var playerIndex = (int)pawn.Controller.Value.EntityIndex!.Value.Value; @@ -114,8 +114,7 @@ public class WeaponPaints : BasePlugin } g_playersSkins[steamId.SteamId64][weaponId] = weaponPaint; - } - ); + }); } catch (Exception) {