diff --git a/src/common/textures/hw_material.cpp b/src/common/textures/hw_material.cpp index c6b38e5a6..2517c098e 100644 --- a/src/common/textures/hw_material.cpp +++ b/src/common/textures/hw_material.cpp @@ -133,12 +133,15 @@ FMaterial::FMaterial(FGameTexture * tx, int scaleflags) if (index >= FIRST_USER_SHADER) { const UserShaderDesc& usershader = usershaders[index - FIRST_USER_SHADER]; - if (tx->Layers && usershader.shaderType == mShaderIndex) // Only apply user shader if it matches the expected material + if (usershader.shaderType == mShaderIndex) // Only apply user shader if it matches the expected material { - for (auto& texture : tx->Layers->CustomShaderTextures) + if (tx->Layers) { - if (texture == nullptr) continue; - mTextureLayers.Push({ texture.get(), 0 }); // scalability should be user-definable. + for (auto& texture : tx->Layers->CustomShaderTextures) + { + if (texture == nullptr) continue; + mTextureLayers.Push({ texture.get(), 0 }); // scalability should be user-definable. + } } mShaderIndex = index; }