From 1df391a56b270cd58d1d247cdc555dd00b731abc Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 20:41:27 +0000 Subject: [PATCH] Fix(drawable): Prevent crash with null custom ambient sound info during save --- .../GameEngine/Source/GameClient/Drawable.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index 1694a36a326..214ac623ff7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -5405,9 +5405,19 @@ void Drawable::xfer(Xfer* xfer) { if (!customizedToSilence) { - AsciiString baseInfoName = m_customSoundAmbientInfo->getOriginalName(); - xfer->xferAsciiString(&baseInfoName); - m_customSoundAmbientInfo->xferNoName(xfer); + // Guard against dangling or invalid pointer before dereferencing + if (m_customSoundAmbientInfo != NULL) + { + AsciiString baseInfoName = m_customSoundAmbientInfo->getOriginalName(); + xfer->xferAsciiString(&baseInfoName); + m_customSoundAmbientInfo->xferNoName(xfer); + } + else + { + DEBUG_CRASH(("Drawable::xfer - m_customSoundAmbientInfo is NULL during save but customized flag is set; skipping custom ambient sound save")); + AsciiString emptyName; + xfer->xferAsciiString(&emptyName); + } } } }