Ver Fonte

BufferGeometry/InterleavedBuffer: Set count to 0 if called with undefined array. See clone().

Mr.doob há 9 anos atrás
pai
commit
fd4c58dcbe
2 ficheiros alterados com 2 adições e 2 exclusões
  1. 1 1
      src/core/BufferAttribute.js
  2. 1 1
      src/core/InterleavedBuffer.js

+ 1 - 1
src/core/BufferAttribute.js

@@ -20,7 +20,7 @@ function BufferAttribute( array, itemSize, normalized ) {
 
 	this.array = array;
 	this.itemSize = itemSize;
-	this.count = array.length / itemSize;
+	this.count = array !== undefined ? array.length / itemSize : 0;
 	this.normalized = normalized === true;
 
 	this.dynamic = false;

+ 1 - 1
src/core/InterleavedBuffer.js

@@ -10,7 +10,7 @@ function InterleavedBuffer( array, stride ) {
 
 	this.array = array;
 	this.stride = stride;
-	this.count = array.length / stride;
+	this.count = array !== undefined ? array.length / stride : 0;
 
 	this.dynamic = false;
 	this.updateRange = { offset: 0, count: - 1 };