diff --git a/src/xenia/gpu/gl4/gl4_shader.cc b/src/xenia/gpu/gl4/gl4_shader.cc index 7aef47111..423e86d4b 100644 --- a/src/xenia/gpu/gl4/gl4_shader.cc +++ b/src/xenia/gpu/gl4/gl4_shader.cc @@ -345,12 +345,13 @@ bool GL4Shader::CompileProgram(std::string source) { // Note that we put the translated source first so we get good line numbers. FILE* f = fopen(file_name, "w"); - fprintf(f, "%s", translated_disassembly_.c_str()); - fprintf(f, "\n\n"); - fprintf(f, "/*\n"); - fprintf(f, "%s", ucode_disassembly_.c_str()); - fprintf(f, " */\n"); - fclose(f); + if (f) { + fprintf(f, translated_disassembly_.c_str()); + fprintf(f, "/*\n"); + fprintf(f, "%s", ucode_disassembly_.c_str()); + fprintf(f, " */\n"); + fclose(f); + } } program_ = glCreateShaderProgramv(shader_type_ == ShaderType::kVertex