fix: Fixes NPE in BaseRanged.OnMiss (#1433)

This commit is contained in:
Kamron Batman 2023-07-27 09:17:52 -07:00 • committed by GitHub
parent 72557ffb97
commit 4dddc8d3f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using ModernUO.Serialization;
using Server.Mobiles;
using Server.Network;
@ -134,8 +135,12 @@ namespace Server.Items
{
var ammo = AmmoType;
pm.RecoverableAmmo.TryGetValue(ammo, out var result);
pm.RecoverableAmmo[ammo] = result + 1;
if (ammo != null)
{
pm.RecoverableAmmo ??= new Dictionary<Type, int>();
pm.RecoverableAmmo.TryGetValue(ammo, out var result);
pm.RecoverableAmmo[ammo] = result + 1;
}
if (!pm.Warmode)
{