Browse Source

Editor/App: Don't break when handling unused scripts.

Mr.doob 9 years ago
parent
commit
ab883fb896
1 changed files with 8 additions and 1 deletions
  1. 8 1
      editor/js/libs/app.js

+ 8 - 1
editor/js/libs/app.js

@@ -61,6 +61,13 @@ var APP = {
 
 
 				var object = scene.getObjectByProperty( 'uuid', uuid, true );
 				var object = scene.getObjectByProperty( 'uuid', uuid, true );
 
 
+				if ( object === undefined ) {
+
+					console.warn( 'APP.Player: Script without object.', uuid );
+					continue;
+
+				}
+
 				var scripts = json.scripts[ uuid ];
 				var scripts = json.scripts[ uuid ];
 
 
 				for ( var i = 0; i < scripts.length; i ++ ) {
 				for ( var i = 0; i < scripts.length; i ++ ) {
@@ -76,7 +83,7 @@ var APP = {
 
 
 						if ( events[ name ] === undefined ) {
 						if ( events[ name ] === undefined ) {
 
 
-							console.warn( 'APP.Player: event type not supported (', name, ')' );
+							console.warn( 'APP.Player: Event type not supported (', name, ')' );
 							continue;
 							continue;
 
 
 						}
 						}