Skip to content

Commit cfcd56d

Browse files
committed
Fixed nullptr deference due to no wound
1 parent fee6726 commit cfcd56d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Source/Entities/Attachable.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,20 @@ bool Attachable::ParticlePenetration(HitData& hd) {
296296
MovableObject* hitor = hd.Body[HITOR];
297297
float damageToAdd = hitor->DamageOnCollision();
298298
damageToAdd += penetrated ? hitor->DamageOnPenetration() : 0;
299-
if (hitor->GetApplyWoundDamageOnCollision()) {
300-
damageToAdd += m_pEntryWound->GetEmitDamage() * hitor->WoundDamageMultiplier();
301-
}
302-
if (hitor->GetApplyWoundBurstDamageOnCollision()) {
303-
damageToAdd += m_pEntryWound->GetBurstDamage() * hitor->WoundDamageMultiplier();
299+
300+
if (m_pEntryWound) {
301+
if (hitor->GetApplyWoundDamageOnCollision()) {
302+
damageToAdd += m_pEntryWound->GetEmitDamage() * hitor->WoundDamageMultiplier();
303+
}
304+
if (hitor->GetApplyWoundBurstDamageOnCollision()) {
305+
damageToAdd += m_pEntryWound->GetBurstDamage() * hitor->WoundDamageMultiplier();
306+
}
304307
}
305308

306309
if (damageToAdd != 0) {
307310
AddDamage(damageToAdd);
308311
}
312+
309313
if (penetrated || damageToAdd != 0) {
310314
if (Actor* parentAsActor = dynamic_cast<Actor*>(GetRootParent()); parentAsActor && parentAsActor->GetPerceptiveness() > 0) {
311315
Vector extruded(hd.HitVel[HITOR]);

0 commit comments

Comments
 (0)