diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp index f61baf015bc..c21ad924202 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp @@ -2461,6 +2461,10 @@ void BaseHeightMapRenderObjClass::renderShoreLines(CameraClass *pCamera) if (DX8Wrapper::getBackBufferFormat() != WW3D_FORMAT_A8R8G8B8) return; //can't apply effect on cards without destination alpha + // Safety check: ensure m_map is valid before dereferencing + if (!m_map) + return; + Int vertexCount = 0; Int indexCount = 0; Int drawEdgeY=m_map->getDrawOrgY()+m_map->getDrawHeight()-1; @@ -2624,6 +2628,10 @@ void BaseHeightMapRenderObjClass::renderShoreLinesSorted(CameraClass *pCamera) if (DX8Wrapper::getBackBufferFormat() != WW3D_FORMAT_A8R8G8B8) return; //can't apply effect on cards without destination alpha + // Safety check: ensure m_map is valid before dereferencing + if (!m_map) + return; + Int vertexCount = 0; Int indexCount = 0; Int drawEdgeY=m_map->getDrawOrgY()+m_map->getDrawHeight()-1;