Browse Source

Check whether geometry has any faces before accessing faces[0]

Arthur Silber 10 years ago
parent
commit
f4bde6e94f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/core/BufferGeometry.js

+ 1 - 1
src/core/BufferGeometry.js

@@ -268,7 +268,7 @@ THREE.BufferGeometry.prototype = {
 		var hasFaceVertexUv = faceVertexUvs[ 0 ].length > 0;
 		var hasFaceVertexUv2 = faceVertexUvs[ 1 ] && faceVertexUvs[ 1 ].length > 0;
 
-		var hasFaceVertexNormals = faces[ 0 ].vertexNormals.length == 3;
+		var hasFaceVertexNormals = faces[ 0 ] && faces[ 0 ].vertexNormals.length == 3;
 
 		var positions = new Float32Array( faces.length * 3 * 3 );
 		this.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );