Don't crash when backing up the root directory because it has no name

This commit is contained in:
Olivier 'reivilibre' 2022-06-01 09:16:05 +01:00
parent 001d626ccd
commit d62e864bee
1 changed files with 6 additions and 1 deletions

View File

@ -323,7 +323,12 @@ pub fn store_without_pointer_ops<PT: ProgressTracker>(
let chunk_ref = commands::store_tree_node(
&pile,
&RootTreeNode {
name: root_dir.file_name().unwrap().to_str().unwrap().to_owned(),
name: root_dir
.file_name()
.map(|s| s.to_str())
.flatten()
.unwrap_or("_root")
.to_owned(),
node: root_node,
},
)?;