Kaynağa Gözat

Check if position is undefined before use position.count

Zhe Zhang 8 yıl önce
ebeveyn
işleme
dd56fe76b7
1 değiştirilmiş dosya ile 12 ekleme ve 9 silme
  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 );
 
-						}
+							}
 
+						}
 					}
 
 				}