mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-23 21:24:27 +00:00
Fix possible null pointer dereference.
This commit is contained in:
parent
e6424f42a7
commit
963e20c1cc
@ -824,7 +824,7 @@ void CFuncTank::TrackTarget( void )
|
||||
BOOL updateTime = FALSE, lineOfSight;
|
||||
Vector angles, direction, targetPosition, barrelEnd;
|
||||
Vector v_right, v_up;
|
||||
CBaseEntity *pTarget;
|
||||
CBaseEntity *pTarget = NULL;
|
||||
CBasePlayer* pController = NULL;
|
||||
|
||||
// ALERT(at_console,"TrackTarget\n");
|
||||
@ -1111,7 +1111,7 @@ void CFuncTank::TrackTarget( void )
|
||||
Vector forward;
|
||||
UTIL_MakeVectorsPrivate( pev->angles, forward, NULL, NULL );
|
||||
|
||||
if( pev->spawnflags & SF_TANK_LINEOFSIGHT )
|
||||
if( pTarget && pev->spawnflags & SF_TANK_LINEOFSIGHT )
|
||||
{
|
||||
float length = direction.Length();
|
||||
UTIL_TraceLine( barrelEnd, barrelEnd + forward * length, dont_ignore_monsters, edict(), &tr );
|
||||
|
@ -259,7 +259,7 @@ void CLocusBeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
|
||||
CBaseEntity *pEndEnt;
|
||||
Vector vecStartPos;
|
||||
Vector vecEndPos;
|
||||
CBeam *pBeam;
|
||||
CBeam *pBeam = NULL;
|
||||
|
||||
switch(pev->impulse)
|
||||
{
|
||||
@ -297,6 +297,10 @@ void CLocusBeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
|
||||
pBeam->PointsInit( vecStartPos, vecStartPos + vecEndPos );
|
||||
break;
|
||||
}
|
||||
|
||||
if( !pBeam )
|
||||
return;
|
||||
|
||||
pBeam->SetColor( pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z );
|
||||
pBeam->SetBrightness( pev->renderamt );
|
||||
pBeam->SetNoise( m_iDistortion );
|
||||
|
Loading…
x
Reference in New Issue
Block a user