From feb067240a1d1e18f399108126d73862e290b43e Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2026 23:05:27 +0000 Subject: [PATCH] fix(objectcreation): Prevent null drawable crash during object creation --- .../GameLogic/Object/ObjectCreationList.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index b3a4eb1ade5..079a949befd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -932,16 +932,20 @@ class GenericObjectCreationNugget : public ObjectCreationNugget if (!m_nameAreObjects) { - for (DrawModule** dm = obj->getDrawable()->getDrawModules(); *dm; ++dm) + Drawable* draw = obj->getDrawable(); + if (draw) { - DebrisDrawInterface* di = (*dm)->getDebrisDrawInterface(); - if (di) + for (DrawModule** dm = draw->getDrawModules(); *dm; ++dm) { - di->setModelName(modelName, m_okToChangeModelColor ? obj->getIndicatorColor() : 0, m_shadowType); - if (!m_animSets.empty()) + DebrisDrawInterface* di = (*dm)->getDebrisDrawInterface(); + if (di) { - Int which = GameLogicRandomValue(0, m_animSets.size()-1); - di->setAnimNames(m_animSets[which].m_animInitial, m_animSets[which].m_animFlying, m_animSets[which].m_animFinal, m_fxFinal); + di->setModelName(modelName, m_okToChangeModelColor ? obj->getIndicatorColor() : 0, m_shadowType); + if (!m_animSets.empty()) + { + Int which = GameLogicRandomValue(0, m_animSets.size()-1); + di->setAnimNames(m_animSets[which].m_animInitial, m_animSets[which].m_animFlying, m_animSets[which].m_animFinal, m_fxFinal); + } } } } @@ -1328,7 +1332,8 @@ class GenericObjectCreationNugget : public ObjectCreationNugget AudioEventRTS fadeAudioEvent(m_fadeSoundName); fadeAudioEvent.setObjectID(sourceObj->getID()); TheAudio->addAudioEvent(&fadeAudioEvent); - debris->getDrawable()->fadeIn(m_fadeFrames); + if (debris->getDrawable()) + debris->getDrawable()->fadeIn(m_fadeFrames); } if (m_fadeOut) @@ -1336,7 +1341,8 @@ class GenericObjectCreationNugget : public ObjectCreationNugget AudioEventRTS fadeAudioEvent(m_fadeSoundName); fadeAudioEvent.setObjectID(sourceObj->getID()); TheAudio->addAudioEvent(&fadeAudioEvent); - debris->getDrawable()->fadeOut(m_fadeFrames); + if (debris->getDrawable()) + debris->getDrawable()->fadeOut(m_fadeFrames); } }