Browse Source

Merge pull request #17548 from Mugen87/dev38

Geometry: Better logging in .fromBufferGeometry().
Michael Herzog 5 years ago
parent
commit
f23cb9f6de
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/core/Geometry.js

+ 7 - 0
src/core/Geometry.js

@@ -189,6 +189,13 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		var indices = geometry.index !== null ? geometry.index.array : undefined;
 		var attributes = geometry.attributes;
 
+		if ( attributes.position === undefined ) {
+
+			console.error( 'THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.' );
+			return this;
+
+		}
+
 		var positions = attributes.position.array;
 		var normals = attributes.normal !== undefined ? attributes.normal.array : undefined;
 		var colors = attributes.color !== undefined ? attributes.color.array : undefined;