Browse Source

Add tracks length check for MMDHelper

Takahiro 8 years ago
parent
commit
228257762a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      examples/js/loaders/MMDLoader.js

+ 3 - 2
examples/js/loaders/MMDLoader.js

@@ -2304,7 +2304,8 @@ THREE.MMDHelper.prototype = {
 			//       the name of them begins with "_".
 			mesh.mixer.addEventListener( 'loop', function ( e ) {
 
-				if ( e.action._clip.tracks[ 0 ].name.indexOf( '.bones' ) !== 0 ) return;
+				if ( e.action._clip.tracks.length > 0 &&
+				     e.action._clip.tracks[ 0 ].name.indexOf( '.bones' ) !== 0 ) return;
 
 				var mesh = e.target._root;
 				mesh.looped = true;
@@ -2320,7 +2321,7 @@ THREE.MMDHelper.prototype = {
 
 				var action = mesh.mixer.clipAction( clip );
 
-				if ( clip.tracks[ 0 ].name.indexOf( '.morphTargetInfluences' ) === 0 ) {
+				if ( clip.tracks.length > 0 && clip.tracks[ 0 ].name.indexOf( '.morphTargetInfluences' ) === 0 ) {
 
 					if ( ! foundMorphAnimation ) {