source-engine
source-engine copied to clipboard
[All Versions?] CRASH: CAI_TrackPather::UpdateCurrentTargetLeading()
Game: HL2 & EP1 &EP2
Tested on version: Android Source Engine V1.16: CRASH Android Source Engine V1.09: CRASH Windows version Source Engine compiled from [latest] code: CRASH
To reproduce the problem:
Step 1: Load a map, I used an old version of gm_flatgrass
or a custom map I made.
Step 2: In console, enter sv_cheats 1
, then ch_createairboat
to create an airboat.
Step 3: In console, enter ent_create npc_helicopter
or give npc_helicopter
to create a helicopter NPC.
Step 4: Enter the airboat, then the game will CRASH.
Also, I tried some other NPCs, such as APC (prop_vehicle_apc
+ npc_apcdriver
) by using my entity .cfg script, sometimes the game will also crash as the player enters the airboat. Maybe for the npc_strider
, the game will also crash?
On Windows version, attaching hl2_launcher.exe
to Visual Studio
for debugging, when the game crashes, the VS says "ACCESS VIOLATION" stops at const Vector &vecTarget = m_pCurrentPathTarget->GetAbsOrigin();
in void CAI_TrackPather::UpdateCurrentTargetLeading()
in ai_trackpather.cpp
.
Here is the "Call Stack":
> server.dll!CAI_TrackPather::UpdateCurrentTargetLeading() Line 1030 C++
server.dll!CNPC_AttackHelicopter::Hunt() Line 4780 C++
server.dll!CBaseHelicopter::HelicopterThink() Line 328 C++
server.dll!CBaseEntity::PhysicsDispatchThink(void(CBaseEntity::*)() thinkFunc) Line 940 C++
server.dll!CBaseEntity::PhysicsRunSpecificThink(int nContextIndex, void(CBaseEntity::*)() thinkFunc) Line 2119 C++
server.dll!CBaseEntity::PhysicsRunThink(CBaseEntity::thinkmethods_t thinkMethod) Line 1915 C++
server.dll!CBaseEntity::StepSimulationThink(float dt) Line 1637 C++
server.dll!CBaseEntity::PhysicsStep() Line 1780 C++
server.dll!Physics_SimulateEntity(CBaseEntity * pEntity) Line 2010 C++
server.dll!Physics_RunThinkFunctions(bool simulating) Line 2064 C++
server.dll!CServerGameDLL::GameFrame(bool simulating) Line 1230 C++
engine.dll!CServerPlugin::GameFrame(bool simulating) Line 424 C++
engine.dll!SV_Think(bool bIsSimulating) Line 2859 C++
engine.dll!SV_Frame(bool finalTick) Line 2960 C++
engine.dll!_Host_RunFrame(float time) Line 3247 C++
engine.dll!Host_RunFrame(float time) Line 3619 C++
engine.dll!CHostState::FrameUpdate(float time) Line 648 C++
engine.dll!HostState_Frame(float time) Line 125 C++
engine.dll!CEngine::Frame() Line 432 C++
engine.dll!CEngineAPI::MainLoop() Line 1544 C++
engine.dll!CModAppSystemGroup::Main() Line 2113 C++
engine.dll!CAppSystemGroup::Run() Line 383 C++
engine.dll!CEngineAPI::RunListenServer() Line 1827 C++
engine.dll!StaticRunListenServer(void * arg) Line 1843 C++
tier0.dll!CatchAndWriteContext_t::Invoke() Line 379 C++
tier0.dll!CatchAndWriteMiniDump_Impl(CatchAndWriteContext_t & ctx) Line 446 C++
tier0.dll!CatchAndWriteMiniDumpForVoidPtrFn(void(*)(void *) pfn, void * pv, bool bExitQuietly) Line 524 C++
engine.dll!CEngineAPI::Run() Line 1921 C++
launcher.dll!CAppSystemGroup::Run() Line 383 C++
launcher.dll!LauncherMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 1487 C++
hl2_launcher.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 141 C++
Well, I know about this bug. That's can be fixed by inserting null pointer check, but maybe that's not right solution of this problem
I will check this out
Well, I know about this bug. That's can be fixed by inserting null pointer check, but maybe that's not right solution of this problem
@nillerusr Thanks for checking this problem out. And yeah, as what you've said, inserting null pointer check (everywhere) in the game code may not be the right solution of this problem. Because I have found more game crashing problems caused by null pointer
. For example, the func_tankapcrocket
(this is an automatic rocket turret entity, spawned by my custom entity script) crash in the EP2 strider defense level, or parented to a vehicle and the player drives the vehicle pass through the "level changing region", caused by a null pointer in CBaseEntity::CalcAbsolutePosition
. Is it possible to incorporate the null pointer check
in the engine-level, rather than the game-level (or source-sdk-level)? This can be very useful for non-binary-code game modding (by .cfg entity scripts) as there will be less crashes.
The func_tankapcrocket
entity script can be found here, which is fun to play on some simple maps like gm_flatgrass
in which the game will not crash by the null pointer problem:
https://github.com/steadyfield/HL2_Entity_Script/blob/main/auto_weapon/create_auto_apcrocketlauncher.cfg