mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:50:44 -05:00
Fix for DogtagPatch NRE when Weapon Name is Null (!154)
Added null check for `damageInfo.Weapon.Name` in `DogtagPatch::UpdateDogtagItemWithDeathDetails` because it can be null in rare cases. I see this happen when Zryachiy or his followers kill a bot, and I'm not sure why. This will prevent an exception from being thrown and the bot becoming "broken". Reviewed-on: SPT/Modules#154 Co-authored-by: dwesterwick <dwesterwick@yahoo.com> Co-committed-by: dwesterwick <dwesterwick@yahoo.com>
This commit is contained in:
parent
2faf204d77
commit
9357555280
@ -94,7 +94,15 @@ namespace SPT.SinglePlayer.Patches.Quests
|
|||||||
itemComponent.Status = "Killed by ";
|
itemComponent.Status = "Killed by ";
|
||||||
itemComponent.KillerAccountId = aggressor.Profile.AccountId;
|
itemComponent.KillerAccountId = aggressor.Profile.AccountId;
|
||||||
itemComponent.KillerProfileId = aggressor.Profile.Id;
|
itemComponent.KillerProfileId = aggressor.Profile.Id;
|
||||||
itemComponent.WeaponName = damageInfo.Weapon.Name;
|
|
||||||
|
string weaponName = damageInfo.Weapon?.Name;
|
||||||
|
if (weaponName == null)
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"DogtagPatch error > The weapon used by {itemComponent.KillerName} to kill {itemComponent.Nickname} is null");
|
||||||
|
weaponName = "???";
|
||||||
|
}
|
||||||
|
|
||||||
|
itemComponent.WeaponName = weaponName;
|
||||||
|
|
||||||
if (__instance.Profile.Info.Experience > 0)
|
if (__instance.Profile.Info.Experience > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user