- fixed crash during autoloading of material textures

https://forum.zdoom.org/viewtopic.php?t=60546
This commit is contained in:
alexey.lysiuk 2018-05-10 18:01:29 +03:00
parent a7e7db1fe9
commit 2c2b19bb7f

View file

@ -1050,9 +1050,12 @@ void FTextureManager::Init()
InitPalettedVersions();
AdjustSpriteOffsets();
// Add auto materials to each texture after everything has been set up.
for (auto &tex : Textures)
// Textures array can be reallocated in process, so ranged for loop is not suitable.
// There is no need to process discovered material textures here,
// CheckForTexture() did this already.
for (unsigned int i = 0, count = Textures.Size(); i < count; ++i)
{
tex.Texture->AddAutoMaterials();
Textures[i].Texture->AddAutoMaterials();
}
glLight = TexMan.CheckForTexture("glstuff/gllight.png", ETextureType::MiscPatch);