浏览代码

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

Mr.doob 9 年之前
父节点
当前提交
ab883fb896
共有 1 个文件被更改,包括 8 次插入1 次删除
  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 );
 
+				if ( object === undefined ) {
+
+					console.warn( 'APP.Player: Script without object.', uuid );
+					continue;
+
+				}
+
 				var scripts = json.scripts[ uuid ];
 
 				for ( var i = 0; i < scripts.length; i ++ ) {
@@ -76,7 +83,7 @@ var APP = {
 
 						if ( events[ name ] === undefined ) {
 
-							console.warn( 'APP.Player: event type not supported (', name, ')' );
+							console.warn( 'APP.Player: Event type not supported (', name, ')' );
 							continue;
 
 						}