Browse Source

WebGLRenderer: Fixed premature access to index.array.

Mr.doob 11 years ago
parent
commit
0194721f09
1 changed files with 14 additions and 14 deletions
  1. 14 14
      src/renderers/WebGLRenderer.js

+ 14 - 14
src/renderers/WebGLRenderer.js

@@ -2577,24 +2577,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			var index = geometryAttributes[ "index" ];
 			var index = geometryAttributes[ "index" ];
 
 
-			var type, size;
-			
-			if ( index.array instanceof Uint32Array ) {
-				
-				type = _gl.UNSIGNED_INT;
-				size = 4;
-				
-			} else {
-				
-				type = _gl.UNSIGNED_SHORT;
-				size = 2;
-				
-			}
-
 			if ( index ) {
 			if ( index ) {
 
 
 				// indexed triangles
 				// indexed triangles
 
 
+				var type, size;
+			
+				if ( index.array instanceof Uint32Array ) {
+					
+					type = _gl.UNSIGNED_INT;
+					size = 4;
+					
+				} else {
+					
+					type = _gl.UNSIGNED_SHORT;
+					size = 2;
+					
+				}
+
 				var offsets = geometry.offsets;
 				var offsets = geometry.offsets;
 
 
 				if ( offsets.length === 0 ) {
 				if ( offsets.length === 0 ) {