Skip to content

Commit e100c75

Browse files
committed
fixed crash in fs tree creation
1 parent 279d224 commit e100c75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fyrox-ui/src/file_browser/fs_tree.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl FsTree {
385385
let dest_path_components = dest_path.components().collect::<Vec<Component>>();
386386

387387
let RootsCollection {
388-
items: root_items,
388+
items: mut root_items,
389389
root_item: mut parent,
390390
} = RootsCollection::new(&dest_path_components, root, &menu, root_title, ctx);
391391

@@ -423,7 +423,11 @@ impl FsTree {
423423
root_title,
424424
);
425425

426-
Tree::add_item(parent, item, ctx);
426+
if parent.is_some() {
427+
Tree::add_item(parent, item, ctx);
428+
} else {
429+
root_items.push(item);
430+
}
427431

428432
if is_part_of_final_path {
429433
new_parent = item;

0 commit comments

Comments
 (0)