Skip to content

Commit

Permalink
Fix nullref on firearmpacket
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed May 13, 2024
1 parent c658c6c commit e9c9c2d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ public void HandleFirearmPacket(in WeaponPacket packet, InventoryControllerClass
}
else if (packet.ShotInfoPacket.ShotType == EShotType.RegularShot)
{
if (string.IsNullOrEmpty(packet.ShotInfoPacket.AmmoTemplate))
{
FikaPlugin.Instance.FikaLogger.LogError("CoopObservedFirearmController::HandleFirearmPacket: AmmoTemplate was null or empty!");
return;
}

BulletClass ammo = (BulletClass)Singleton<ItemFactory>.Instance.CreateItem(MongoID.Generate(), packet.ShotInfoPacket.AmmoTemplate, null);
InitiateShot(Item, ammo, packet.ShotInfoPacket.ShotPosition, packet.ShotInfoPacket.ShotDirection,
packet.ShotInfoPacket.FireportPosition, packet.ShotInfoPacket.ChamberIndex, packet.ShotInfoPacket.Overheat);
Expand Down

0 comments on commit e9c9c2d

Please sign in to comment.