Commit 2b9895f2 authored by Hubert Figuière's avatar Hubert Figuière
Browse files

ui: fix crash if there is no previously open soundfont

parent 3ff0b270
......@@ -75,14 +75,10 @@ impl ObjectImpl for FileChooserButtonPriv {
let priv_ = FileChooserButtonPriv::from_instance(b);
// We must hold a reference to the Native dialog, or it crashes.
priv_.dialog.replace(Some(file_chooser.clone()));
print_on_err!(file_chooser.set_current_folder(
priv_
.file
.borrow()
.as_ref()
.and_then(|f| f.parent())
.as_ref()
));
let current_folder = priv_.file.borrow().as_ref().and_then(|f| f.parent());
if current_folder.is_some() {
print_on_err!(file_chooser.set_current_folder(current_folder.as_ref()));
}
file_chooser.connect_response(glib::clone!(@weak b => move |w, r| {
if r == gtk4::ResponseType::Accept {
b.set_property("file", &w.file());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment