From f9aee08dde6b7d7030bbce166f47bb1cf994a8f3 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Tue, 13 Aug 2019 12:29:14 -0300 Subject: [PATCH] Work around user-reported error where getProgramInfoLog returned null --- src/webgl/WglShader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webgl/WglShader.js b/src/webgl/WglShader.js index 4268ef4d..c68ae8eb 100644 --- a/src/webgl/WglShader.js +++ b/src/webgl/WglShader.js @@ -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))) {