瀏覽代碼

WebGLRenderer: remove redundant code (#28186)

The null check seems to have been redundant.

This code should behave the same as the previous code and return `null` when
`context === null` or return `context` otherwise.

Maybe there is a good reason it was like it was (ability to put a debugger on
line 227?) in which case feel free to decline this PR - I just came across the
code when I was searching for something else and thought I'd clean it up in
case it was unnecessarily there based on a historical change...
Kelvin Luck 1 年之前
父節點
當前提交
4d6fa0d96f
共有 1 個文件被更改,包括 1 次插入4 次删除
  1. 1 4
      src/renderers/WebGLRenderer.js

+ 1 - 4
src/renderers/WebGLRenderer.js

@@ -218,10 +218,7 @@ class WebGLRenderer {
 
 		function getContext( contextName, contextAttributes ) {
 
-			const context = canvas.getContext( contextName, contextAttributes );
-			if ( context !== null ) return context;
-
-			return null;
+			return canvas.getContext( contextName, contextAttributes );
 
 		}