From cd1dafdc26046089c0dfd6673d1f3b7c816ad5e5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 6 Dec 2024 10:12:12 +0100 Subject: [PATCH] don't crash when no dir --- src/utils/routes/cours.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/routes/cours.rs b/src/utils/routes/cours.rs index d5b62f8..aa0301f 100644 --- a/src/utils/routes/cours.rs +++ b/src/utils/routes/cours.rs @@ -36,7 +36,11 @@ pub fn get_filetree( exclusion_list: &[String], exclusion_patterns: &[Regex], ) -> FileNode { - gen_filetree(initial_dir, exclusion_list, exclusion_patterns).unwrap() + gen_filetree(initial_dir, exclusion_list, exclusion_patterns).unwrap_or(FileNode { + name: String::new(), + is_dir: false, + children: vec![], + }) } fn gen_filetree(