Skip to content

Commit

Permalink
fixed crash when trying to create parent for root in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
mrDIMAS committed May 29, 2024
1 parent 2f93c04 commit 4042daa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion editor/src/world/graph/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl SceneNodeContextMenu {
};

let new_parent_handle = scene.graph.generate_free_handles(1)[0];
let commands = CommandGroup::from(vec![
let mut commands = CommandGroup::from(vec![
Command::new(AddNodeCommand::new(node, parent, true)),
Command::new(LinkNodesCommand::new(*first, new_parent_handle)),
Command::new(MoveNodeCommand::new(
Expand All @@ -246,6 +246,12 @@ impl SceneNodeContextMenu {
position,
)),
]);
if *first == game_scene.scene_content_root {
commands.push(SetGraphRootCommand {
root: new_parent_handle,
link_scheme: Default::default(),
})
}
sender.do_command(commands);
}
}
Expand Down

0 comments on commit 4042daa

Please sign in to comment.