Skip to content

Commit

Permalink
Work around user-reported error where getProgramInfoLog returned null
Browse files Browse the repository at this point in the history
  • Loading branch information
Strilanc committed Aug 13, 2019
1 parent b7add27 commit f9aee08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/webgl/WglShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ class WglCompiledShader {
gl.attachShader(program, glFragmentShader);
gl.linkProgram(program);

let warnings = gl.getProgramInfoLog(program).trim();
// Note: MDN says the result of getProgramInfoLog is always a DOMString, but a user reported an
// error where it returned null. So now we fallback to the empty string when getting a falsy value.
let warnings = (gl.getProgramInfoLog(program) || '').trim();
if (warnings !== '' &&
warnings !== '\0' && // [happened in Ubuntu with NVIDIA GK107GL]
Config.SUPPRESSED_GLSL_WARNING_PATTERNS.every(e => !e.test(warnings))) {
Expand Down

0 comments on commit f9aee08

Please sign in to comment.