Browse Source

Fix exception with glTFFileLoader when no textures in asset

Gary Hsu 8 years ago
parent
commit
770b0563c9
1 changed files with 6 additions and 4 deletions
  1. 6 4
      loaders/src/glTF/2.0/babylon.glTFLoader.ts

+ 6 - 4
loaders/src/glTF/2.0/babylon.glTFLoader.ts

@@ -804,10 +804,12 @@ module BABYLON.GLTF2 {
         }
 
         // Revoke object urls created during load
-        for (var i = 0; i < runtime.gltf.textures.length; i++) {
-            var texture = runtime.gltf.textures[i];
-            if (texture.blobURL) {
-                URL.revokeObjectURL(texture.blobURL);
+        if (runtime.gltf.textures) {
+            for (var i = 0; i < runtime.gltf.textures.length; i++) {
+                var texture = runtime.gltf.textures[i];
+                if (texture.blobURL) {
+                    URL.revokeObjectURL(texture.blobURL);
+                }
             }
         }
     };