Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osprey crashes if it has no valid target #3259

Open
SamVanheer opened this issue Mar 14, 2022 · 0 comments
Open

Osprey crashes if it has no valid target #3259

SamVanheer opened this issue Mar 14, 2022 · 0 comments

Comments

@SamVanheer
Copy link

SamVanheer commented Mar 14, 2022

If a monster_osprey is spawned with no valid target it will crash when it attempts to skip targets that are used for the grunt resupply path.

Change this:

halflife/dlls/osprey.cpp

Lines 397 to 404 in c7240b9

if (m_pGoalEnt->pev->speed == 0)
{
SetThink( &COsprey::DeployThink );
}
do {
m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING( m_pGoalEnt->pev->target ) ) );
} while (m_pGoalEnt->pev->speed < 400 && !HasDead());
UpdateGoal( );

To this:

if (m_pGoalEnt != nullptr)
{
	if (m_pGoalEnt->pev->speed == 0)
	{
		SetThink(&COsprey::DeployThink);
	}
	do
	{
		m_pGoalEnt = CBaseEntity::Instance(FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_pGoalEnt->pev->target)));
	} while (m_pGoalEnt->pev->speed < 400 && !HasDead());
	UpdateGoal();
	}

This change adds a null check to prevent the crash.

This also applies to the Black Ops Osprey in Opposing Force.

SamVanheer added a commit to twhl-community/halflife-op4-updated that referenced this issue Mar 15, 2022
…eSoftware/halflife#3259

Fix Black Ops Osprey teleporting to world origin if it isn't moving at all Resolves ValveSoftware/halflife#3260
Fix Black Ops Osprey not firing trigger targets Resolves ValveSoftware/halflife#3261
@SamVanheer SamVanheer reopened this May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants