Commit 700ad289 by Corentin Wallez

Don't crash when calling ShConstructCompiler with a wrong output

BUG=angleproject:446 Change-Id: Ic1c326f79105950e5c3eb8724eba12fca187a2ec Reviewed-on: https://chromium-review.googlesource.com/316610 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent e102fee7
...@@ -40,11 +40,11 @@ TCompiler* ConstructCompiler( ...@@ -40,11 +40,11 @@ TCompiler* ConstructCompiler(
#else #else
// This compiler is not supported in this // This compiler is not supported in this
// configuration. Return NULL per the ShConstructCompiler API. // configuration. Return NULL per the ShConstructCompiler API.
return NULL; return nullptr;
#endif // ANGLE_ENABLE_HLSL #endif // ANGLE_ENABLE_HLSL
default: default:
// Unknown format. Return NULL per the ShConstructCompiler API. // Unknown format. Return NULL per the ShConstructCompiler API.
return NULL; return nullptr;
} }
} }
......
...@@ -189,9 +189,16 @@ ShHandle ShConstructCompiler(sh::GLenum type, ShShaderSpec spec, ...@@ -189,9 +189,16 @@ ShHandle ShConstructCompiler(sh::GLenum type, ShShaderSpec spec,
const ShBuiltInResources* resources) const ShBuiltInResources* resources)
{ {
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec, output)); TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec, output));
if (base == nullptr)
{
return 0;
}
TCompiler* compiler = base->getAsCompiler(); TCompiler* compiler = base->getAsCompiler();
if (compiler == 0) if (compiler == nullptr)
{
return 0; return 0;
}
// Generate built-in symbol table. // Generate built-in symbol table.
if (!compiler->Init(*resources)) { if (!compiler->Init(*resources)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment