Ver Fonte

Add try-catch for GLTFBinaryExtension

Takahiro há 7 anos atrás
pai
commit
2138f81546
1 ficheiros alterados com 11 adições e 1 exclusões
  1. 11 1
      examples/js/loaders/GLTFLoader.js

+ 11 - 1
examples/js/loaders/GLTFLoader.js

@@ -78,7 +78,17 @@ THREE.GLTFLoader = ( function () {
 
 				if ( magic === BINARY_EXTENSION_HEADER_MAGIC ) {
 
-					extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );
+					try {
+
+						extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );
+
+					} catch ( error ) {
+
+						onError( error );
+						return;
+
+					}
+
 					content = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content;
 
 				} else {