Explorar el Código

Add try-catch for GLTFBinaryExtension

Takahiro hace 7 años
padre
commit
2138f81546
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  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 {