소스 검색

Check if position is undefined before use position.count

Zhe Zhang 8 년 전
부모
커밋
dd56fe76b7
1개의 변경된 파일12개의 추가작업 그리고 9개의 파일을 삭제
  1. 12 9
      src/objects/Mesh.js

+ 12 - 9
src/objects/Mesh.js

@@ -271,22 +271,25 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 				} else {
 
 					// non-indexed buffer geometry
+					
+					if ( position ) {
 
-					for ( i = 0, l = position.count; i < l; i += 3 ) {
+						for ( i = 0, l = position.count; i < l; i += 3 ) {
 
-						a = i;
-						b = i + 1;
-						c = i + 2;
+							a = i;
+							b = i + 1;
+							c = i + 2;
 
-						intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
+							intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
 
-						if ( intersection ) {
+							if ( intersection ) {
 
-							intersection.index = a; // triangle number in positions buffer semantics
-							intersects.push( intersection );
+								intersection.index = a; // triangle number in positions buffer semantics
+								intersects.push( intersection );
 
-						}
+							}
 
+						}
 					}
 
 				}