fix: Fixes NPE in TreasureMapChest (#1010)

This commit is contained in:
Tellundro 2022-05-04 23:10:55 -03:00 • committed by GitHub
parent 861ff307c0
commit 790cb5d733
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -361,12 +361,12 @@ public partial class TreasureMapChest : LockableContainer
public override void OnItemLifted(Mobile from, Item item) public override void OnItemLifted(Mobile from, Item item)
{ {
var notYetLifted = !_lifted.Contains(item); var notYetLifted = _lifted?.Contains(item) != true;
from.RevealingAction(); from.RevealingAction();
if (notYetLifted) if (notYetLifted)
{ {
_lifted ??= new HashSet<Item>();
_lifted.Add(item); _lifted.Add(item);
if (Utility.RandomDouble() <= 0.1) // 10% chance to spawn a new monster if (Utility.RandomDouble() <= 0.1) // 10% chance to spawn a new monster