Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Null Inventory Crash Quickfix (#1382)
Browse files Browse the repository at this point in the history
- Fixed crashes in instances where the inventory null, usually minions.
  • Loading branch information
cabeca1143 authored Mar 26, 2022
1 parent 22893c1 commit 023d8b6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions PacketDefinitions420/PacketNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,18 +751,20 @@ OnEnterVisibilityClient ConstructEnterVisibilityClientPacket(IGameObject o, bool
{
charStackData.SkinID = (uint)c.SkinID;
}

foreach (var item in obj.Inventory.GetAllItems())
if(obj.Inventory != null)
{
var itemData = item.ItemData;
itemDataList.Add(new ItemData
foreach (var item in obj.Inventory.GetAllItems())
{
ItemID = (uint)itemData.ItemId,
ItemsInSlot = (byte)item.StackCount,
Slot = obj.Inventory.GetItemSlot(item),
//Unhardcode this when spell ammo gets introduced
SpellCharges = 0
});
var itemData = item.ItemData;
itemDataList.Add(new ItemData
{
ItemID = (uint)itemData.ItemId,
ItemsInSlot = (byte)item.StackCount,
Slot = obj.Inventory.GetItemSlot(item),
//Unhardcode this when spell ammo gets introduced
SpellCharges = 0
});
}
}
}
buffCountList = new List<KeyValuePair<byte, int>>();
Expand Down

0 comments on commit 023d8b6

Please sign in to comment.