Fail GLSL compilation if compiler initialization fails

Bug: b/137828018
Change-Id: Ia30de6af925213269768e3123d3f4ecf821624fb
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/34468
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/OpenGL/libGLESv2/Shader.cpp b/src/OpenGL/libGLESv2/Shader.cpp
index ba19865..269d884 100644
--- a/src/OpenGL/libGLESv2/Shader.cpp
+++ b/src/OpenGL/libGLESv2/Shader.cpp
@@ -158,8 +158,14 @@
 {
 	if(!compilerInitialized)
 	{
-		InitCompilerGlobals();
-		compilerInitialized = true;
+		compilerInitialized = InitCompilerGlobals();
+
+		if(!compilerInitialized)
+		{
+			infoLog += "GLSL compiler failed to initialize.\n";
+
+			return nullptr;
+		}
 	}
 
 	TranslatorASM *assembler = new TranslatorASM(this, shaderType);
@@ -205,6 +211,13 @@
 	createShader();
 	TranslatorASM *compiler = createCompiler(getType());
 
+	if(!compiler)
+	{
+		deleteShader();
+
+		return;
+	}
+
 	// Ensure we don't pass a nullptr source to the compiler
 	const char *source = "\0";
 	if(mSource)