Przeglądaj źródła

Check if mesh exists before working with it

There is the possibility that there isn't a 'mesh' attribute in the 'geometry' one so we should check if we found a mesh before trying to access its properties
Pascal Häusler 7 lat temu
rodzic
commit
12b90b30a7
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      examples/js/loaders/ColladaLoader.js

+ 4 - 0
examples/js/loaders/ColladaLoader.js

@@ -1759,6 +1759,10 @@ THREE.ColladaLoader.prototype = {
 			};
 
 			var mesh = getElementsByTagName( xml, 'mesh' )[ 0 ];
+			
+			if (!mesh) {
+				return;
+			}
 
 			for ( var i = 0; i < mesh.childNodes.length; i ++ ) {