From 022377cb4854c68f0bd4d227b1cc1aea869cc13d Mon Sep 17 00:00:00 2001 From: Enrico Lumetti Date: Mon, 1 Mar 2021 09:38:00 +0100 Subject: [PATCH] Fix file saving when no file was previously open --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 7c21ba3..91e1be8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -183,7 +183,8 @@ impl AppDelegate for Delegate { if cmd.get(commands::SAVE_FILE_AS).is_some() || cmd.get(commands::SAVE_FILE).is_some() { let mut path_buf = cmd.get(commands::SAVE_FILE_AS) .map(|file_info| file_info.path().to_path_buf()) - .unwrap_or(data.current_file_path.as_ref().cloned().unwrap()); + .or_else(|| data.current_file_path.as_ref().cloned()) + .unwrap(); path_buf.set_extension("stlt"); let res_file = File::create(&path_buf);