From 5f43513ee11ef52ab0e1c346d0b5557d04030d91 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 09:29:00 +0000 Subject: [PATCH] Fix: Add null check for m_detonationWeaponTmpl before using it --- .../Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp | 2 +- .../Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp | 2 +- .../Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp | 2 +- .../Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index e4096fcab7d..8fee2a9a2c6 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -465,7 +465,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); // if it's not the specific thing we were targeting, see if we should incidentally collide... - if (!m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, getObject(), other, m_victimID)) + if (m_detonationWeaponTmpl && !m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, getObject(), other, m_victimID)) { //DEBUG_LOG(("ignoring projectile collision with %s at frame %d",other->getTemplate()->getName().str(),TheGameLogic->getFrame())); return true; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 1b42513fc2a..ca6a3873b36 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -316,7 +316,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); // if it's not the specific thing we were targeting, see if we should incidentally collide... - if (!m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, obj, other, m_victimID)) + if (m_detonationWeaponTmpl && !m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, obj, other, m_victimID)) { //DEBUG_LOG(("ignoring projectile collision with %s at frame %d",other->getTemplate()->getName().str(),TheGameLogic->getFrame())); return true; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index f53b524ee03..c12b5404db6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -468,7 +468,7 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); // if it's not the specific thing we were targeting, see if we should incidentally collide... - if (!m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, getObject(), other, m_victimID)) + if (m_detonationWeaponTmpl && !m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, getObject(), other, m_victimID)) { //DEBUG_LOG(("ignoring projectile collision with %s at frame %d",other->getTemplate()->getName().str(),TheGameLogic->getFrame())); return true; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 385fadf28e4..057b2e60dc7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -326,7 +326,7 @@ Bool MissileAIUpdate::projectileHandleCollision( Object *other ) Object *projectileLauncher = TheGameLogic->findObjectByID( projectileGetLauncherID() ); // if it's not the specific thing we were targeting, see if we should incidentally collide... - if (!m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, obj, other, m_victimID)) + if (m_detonationWeaponTmpl && !m_detonationWeaponTmpl->shouldProjectileCollideWith(projectileLauncher, obj, other, m_victimID)) { //DEBUG_LOG(("ignoring projectile collision with %s at frame %d",other->getTemplate()->getName().str(),TheGameLogic->getFrame())); return true;