mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
fix(macos/dialog): avoid setting empty default_path (#9784)
closes #7566 ref: https://github.com/tauri-apps/tauri/issues/4065 ref: https://github.com/tauri-apps/tauri/pull/4028 ref: https://github.com/tauri-apps/tauri/issues/9762
This commit is contained in:
5
.changes/macos-dialog-crash-default-path-empty.md
Normal file
5
.changes/macos-dialog-crash-default-path-empty.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": "patch:bug"
|
||||
---
|
||||
|
||||
Fix dialog crash on macOS when the `default_path` value is empty.
|
||||
@@ -301,6 +301,10 @@ fn set_default_path(
|
||||
mut dialog_builder: FileDialogBuilder,
|
||||
default_path: PathBuf,
|
||||
) -> FileDialogBuilder {
|
||||
if default_path.as_os_str().is_empty() {
|
||||
return dialog_builder;
|
||||
}
|
||||
|
||||
// we need to adjust the separator on Windows: https://github.com/tauri-apps/tauri/issues/8074
|
||||
let default_path: PathBuf = default_path.components().collect();
|
||||
if default_path.is_file() || !default_path.exists() {
|
||||
|
||||
Reference in New Issue
Block a user