[ALL] Fixed a potential crash with entity damage modifiers
Description
In TF2, damage modifiers are used (mainly on tf_weapon_medigun). However, in other games that don't use damage modifiers, there's a rare potential crash where it tries to find damage modifiers that don't exist. This PR attempts to fix that issue by checking if the damage modifier list has values before proceeding into CBaseEntity::GetAttackDamageScale and CBaseEntity::GetReceivedDamageScale respectively.
Just curious, do you have any more info on what causes this crash to occur? I'm wondering if there is an underlying issue with how m_DamageModifiers is populated.
This crash seems to be caused when there are no damage modifiers in the array (which is the default behavior on HL2DM). I found this crash when playtesting my own HL2 mod and that was the main conclusion I came to, as no other entity in HL2 or HL2DM based mods use damage modifiers.
This seems to get called if damage wasn't calculated through vphysics
Fixed another crash where the info.ScaleDamage( GetReceivedDamageScale( info.GetAttacker() ) ); line was outside of the if ( info.GetAttacker() ) block. Without this change, calling this line would crash the game if info.GetAttacker() returned NULL.
This change is related to the nature of the PR, so I'll keep it included here for consistency's sake.
closing this as i believe this is more of an issue with the mod i was working on rather than it being an issue with the base. this does not seem to happen on hl2dm.