From da877f59a7d278607be13cc88486c505b50d6397 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Mon, 20 Jun 2022 16:31:39 -0700 Subject: [PATCH] fix: Fixes possibel NPE with misbehaving Weapon property (#1083) --- Projects/Server/Mobiles/Mobile.cs | 2 +- Projects/UOContent/Items/Weapons/Fists.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 2677a6051..c86ef7a40 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -738,7 +738,7 @@ namespace Server var weapon = Weapon; - if (!InRange(combatant, weapon.MaxRange)) + if (weapon == null || !InRange(combatant, weapon.MaxRange)) { return; } diff --git a/Projects/UOContent/Items/Weapons/Fists.cs b/Projects/UOContent/Items/Weapons/Fists.cs index 4a4696987..5d2ccecd1 100644 --- a/Projects/UOContent/Items/Weapons/Fists.cs +++ b/Projects/UOContent/Items/Weapons/Fists.cs @@ -35,7 +35,7 @@ namespace Server.Items public override WeaponType DefType => WeaponType.Fists; public override WeaponAnimation DefAnimation => WeaponAnimation.Wrestle; - public static void Initialize() + public static void Configure() { Mobile.DefaultWeapon = new Fists();