diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 1b3c9fc2ba..a195f44375 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -358,6 +358,9 @@ int CMapReader::ApplyTerrainData() for (ssize_t k=0; kGetPatch(i,j)->m_MiniPatches[m][k]; // can't fail + if (tileptr->m_Tex1Index >= m_TerrainTextures.size()) + throw PSERROR_Game_World_MapLoadFailed("Error loading map: terrain tile references an invalid texture index.\nCheck application log for details."); + mp.Tex = m_TerrainTextures[tileptr->m_Tex1Index]; mp.Priority = tileptr->m_Priority;