fix: Fixes NPE in BaseRanged.OnMiss (#1433)
This commit is contained in:
parent
72557ffb97
commit
4dddc8d3f1
2 changed files with 9 additions and 4 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ namespace Server.Mobiles
|
|||
set => SetFlag(PlayerFlag.RefuseTrades, value);
|
||||
}
|
||||
|
||||
public Dictionary<Type, int> RecoverableAmmo { get; } = new();
|
||||
public Dictionary<Type, int> RecoverableAmmo { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime AcceleratedStart { get; set; }
|
||||
|
|
@ -3702,7 +3702,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void RecoverAmmo()
|
||||
{
|
||||
if (!Core.SE || !Alive)
|
||||
if (!Core.SE || !Alive || RecoverableAmmo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue