Skip to content

Commit

Permalink
Add null pointer safety to fx_bonusfire
Browse files Browse the repository at this point in the history
The entity sent over the network in the effect data could potentially not exist once it reaches the client, which would cause a null pointer crash
  • Loading branch information
squeek502 committed Sep 19, 2016
1 parent 917fb3c commit 8bbb56d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cl_dll/ff/ff_fx_bonusfire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ void BonusFireCallback( const CEffectData &data )

Vector projectileOrigin = data.m_vOrigin;
float scale = data.m_flScale;
CBaseEntity *pAffectedEntity = ClientEntityList().GetEnt( data.m_hEntity.GetEntryIndex() );
CBaseEntity *pAffectedEntity = data.getEntity();

if ( !pAffectedEntity )
return;

Vector affectedOrigin = pAffectedEntity->GetAbsOrigin();
Vector deltaVec = (affectedOrigin - projectileOrigin);
VectorNormalize( deltaVec );
Expand Down

0 comments on commit 8bbb56d

Please sign in to comment.