fix: crash when picking up ammo
This commit is contained in:
parent
e73565e805
commit
319e45e27b
|
|
@ -95,20 +95,17 @@ void UShootingComponent::Reload()
|
||||||
|
|
||||||
bool UShootingComponent::AddAmmo(EAmmoType CheckingAmmo, int AddValue)
|
bool UShootingComponent::AddAmmo(EAmmoType CheckingAmmo, int AddValue)
|
||||||
{
|
{
|
||||||
if (IsValid(CurrentGunBase))
|
|
||||||
{
|
|
||||||
// Adding ammo only if type is compatible
|
// Adding ammo only if type is compatible
|
||||||
if (CurrentGunBase->AmmoType == CheckingAmmo)
|
if (CurrentGunBase && CurrentGunBase->AmmoType == CheckingAmmo)
|
||||||
{
|
{
|
||||||
CurrentGunBase->AddAmmo(AddValue);
|
CurrentGunBase->AddAmmo(AddValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (SecondaryGunBase->AmmoType == CheckingAmmo)
|
if (SecondaryGunBase && SecondaryGunBase->AmmoType == CheckingAmmo)
|
||||||
{
|
{
|
||||||
SecondaryGunBase->AddAmmo(AddValue);
|
SecondaryGunBase->AddAmmo(AddValue);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user