diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 7afabdada40..8563e49746a 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -2802,7 +2802,8 @@ void W3DModelDraw::hideAllHeadlights(Bool hide) for (Int subObj = 0; subObj < m_renderObject->Get_Num_Sub_Objects(); subObj++) { RenderObjClass* test = m_renderObject->Get_Sub_Object(subObj); - if (strstr(test->Get_Name(),"HEADLIGHT")) + const char* name = test->Get_Name(); + if (name && strstr(name,"HEADLIGHT")) { test->Set_Hidden(hide); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 5908a041a8d..17878929261 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -2857,7 +2857,8 @@ void W3DModelDraw::hideAllHeadlights(Bool hide) for (Int subObj = 0; subObj < m_renderObject->Get_Num_Sub_Objects(); subObj++) { RenderObjClass* test = m_renderObject->Get_Sub_Object(subObj); - if (strstr(test->Get_Name(),"HEADLIGHT")) + const char* name = test->Get_Name(); + if (name && strstr(name,"HEADLIGHT")) { test->Set_Hidden(hide); }