Browse Source

Editor: Prevent runtime erros when deleting objects.

Mugen87 5 năm trước cách đây
mục cha
commit
cba818faa4
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  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 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 );