Browse Source

GLTFLoader: fix exception when a texture can't be fetched/created (#25014)

* fix: GLTFLoader exception when a texture fails to be fetched/created

* move null check earlier to avoid nullref with KHR_texture_transform
hybridherbst 2 years ago
parent
commit
42c59b4d51
1 changed files with 2 additions and 0 deletions
  1. 2 0
      examples/jsm/loaders/GLTFLoader.js

+ 2 - 0
examples/jsm/loaders/GLTFLoader.js

@@ -3013,6 +3013,8 @@ class GLTFParser {
 
 		return this.getDependency( 'texture', mapDef.index ).then( function ( texture ) {
 
+			if ( ! texture ) return null;
+
 			// Materials sample aoMap from UV set 1 and other maps from UV set 0 - this can't be configured
 			// However, we will copy UV set 0 to UV set 1 on demand for aoMap
 			if ( mapDef.texCoord !== undefined && mapDef.texCoord != 0 && ! ( mapName === 'aoMap' && mapDef.texCoord == 1 ) ) {