From d62e864bee0ba2d6bfbbe117eef16f9a3c49e6fa Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Wed, 1 Jun 2022 09:16:05 +0100 Subject: [PATCH] Don't crash when backing up the root directory because it has no name --- yama/src/operations/storing.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yama/src/operations/storing.rs b/yama/src/operations/storing.rs index 563464a..775a0f6 100644 --- a/yama/src/operations/storing.rs +++ b/yama/src/operations/storing.rs @@ -323,7 +323,12 @@ pub fn store_without_pointer_ops( 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, }, )?;