Przeglądaj źródła

Merge pull request #12192 from wenatuhs/dev

Fix bug: check if position is undefined before use position.count
Mr.doob 8 lat temu
rodzic
commit
5bba4414d1
1 zmienionych plików z 12 dodań i 9 usunięć
  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 );
 
-						}
+							}
 
+						}
 					}
 
 				}