Skip to content

Commit e83e4a1

Browse files
committed
If shader doesn't exist, put an error in the console, don't hard crash
1 parent e1989a9 commit e83e4a1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

engine/source/materials/shaderData.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@ bool ShaderData::initShader()
143143
pixelShaderPath = fullFilename2;
144144
}
145145

146+
bool valid = true;
147+
if (vtexShaderPath != NULL && !ResourceManager->find(vtexShaderPath))
148+
{
149+
Con::errorf("ShaderData::initShader - Could not find vertex shader file: %s", vtexShaderPath);
150+
valid = false;
151+
}
152+
153+
if (pixelShaderPath != NULL && !ResourceManager->find(pixelShaderPath))
154+
{
155+
Con::errorf("ShaderData::initShader - Could not find pixel shader file: %s", pixelShaderPath);
156+
valid = false;
157+
}
158+
159+
if (!valid)
160+
return false;
161+
146162
shader = GFX->createShader( (char*)vtexShaderPath,
147163
(char*)pixelShaderPath,
148164
pixver );

0 commit comments

Comments
 (0)