瀏覽代碼

Editor: Prevent runtime erros when deleting objects.

Mugen87 5 年之前
父節點
當前提交
cba818faa4
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      editor/js/Menubar.Edit.js

+ 4 - 3
editor/js/Menubar.Edit.js

@@ -118,10 +118,11 @@ var MenubarEdit = function ( editor ) {
 
 
 		var object = editor.selected;
 		var object = editor.selected;
 
 
-		var parent = object.parent;
-		if ( parent === undefined ) return; // avoid deleting the camera or scene
+		if ( object !== null && object.parent !== null ) {
 
 
-		editor.execute( new RemoveObjectCommand( editor, object ) );
+			editor.execute( new RemoveObjectCommand( editor, object ) );
+
+		}
 
 
 	} );
 	} );
 	options.add( option );
 	options.add( option );