Skip to content

Commit d619390

Browse files
authored
Merge pull request #20847 from Mugen87/dev41
WebGLPrograms: Make getTextureEncodingFromMap() more robust.
2 parents 6748b35 + 0483bb4 commit d619390

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/renderers/webgl/WebGLPrograms.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ function WebGLPrograms( renderer, cubemaps, extensions, capabilities, bindingSta
8989

9090
let encoding;
9191

92-
if ( ! map ) {
93-
94-
encoding = LinearEncoding;
95-
96-
} else if ( map.isTexture ) {
92+
if ( map && map.isTexture ) {
9793

9894
encoding = map.encoding;
9995

100-
} else if ( map.isWebGLRenderTarget ) {
96+
} else if ( map && map.isWebGLRenderTarget ) {
10197

10298
console.warn( 'THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.' );
10399
encoding = map.texture.encoding;
104100

101+
} else {
102+
103+
encoding = LinearEncoding;
104+
105105
}
106106

107107
return encoding;

0 commit comments

Comments
 (0)