Fix index-out-of-bounds crash when getting shader param substring.

This commit is contained in:
Kai Blaschke
2023-01-25 15:28:34 +01:00
parent ed5f2d91c5
commit 8e594bc8e9

View File

@ -255,7 +255,8 @@ GLuint ShaderEngine::compilePresetShader(const PresentShaderType shaderType, Sha
if (texDesc.first == NULL)
{
if (lowerCaseName.substr(0, 4) == "rand" || lowerCaseName.substr(2, 5) == "_rand")
if ((lowerCaseName.size() >= 4 && lowerCaseName.substr(0, 4) == "rand") ||
(lowerCaseName.size() >= 5 && lowerCaseName.substr(2, 5) == "_rand"))
{
texDesc = textureManager->getRandomTextureName(sampler);
}