Browse Source

Added a check inside of the Projector.js to make sure that before accessing the 0th item of the
vertices array in the line geometry, that the length of the vertices array is more than 0.

- This prevents crashing when a Line object is added to the scene before it has vertices
added to it.

DungFu 11 years ago
parent
commit
0916d79a87
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/core/Projector.js

+ 2 - 0
src/core/Projector.js

@@ -561,6 +561,8 @@ THREE.Projector = function () {
 
 
 					vertices = object.geometry.vertices;
 					vertices = object.geometry.vertices;
 
 
+					if ( vertices.length === 0 ) continue;
+
 					v1 = getNextVertexInPool();
 					v1 = getNextVertexInPool();
 					v1.positionScreen.copy( vertices[ 0 ] ).applyMatrix4( _modelViewProjectionMatrix );
 					v1.positionScreen.copy( vertices[ 0 ] ).applyMatrix4( _modelViewProjectionMatrix );