浏览代码

Test navigator before using it in `WebGLTextures` (#24717)

* Test navigator before using it in WebGLTextures

Otherwise it fails in node, where global navigator object is not defined

* Update WebGLTextures.js

Co-authored-by: Michael Herzog <[email protected]>
Sergey Linev 2 年之前
父节点
当前提交
1fd70895db
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/renderers/webgl/WebGLTextures.js

+ 1 - 1
src/renderers/webgl/WebGLTextures.js

@@ -11,7 +11,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 	const maxTextureSize = capabilities.maxTextureSize;
 	const maxSamples = capabilities.maxSamples;
 	const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
-	const supportsInvalidateFramebuffer = /OculusBrowser/g.test( navigator.userAgent );
+	const supportsInvalidateFramebuffer = /OculusBrowser/g.test( typeof navigator === 'undefined' ? '' : navigator.userAgent );
 
 	const _videoTextures = new WeakMap();
 	let _canvas;