summaryrefslogtreecommitdiff
path: root/src/wx/file_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-01-26 23:46:57 +0100
committerCarl Hetherington <cth@carlh.net>2024-01-26 23:46:57 +0100
commit8e1f9af03e282d9b995bcc58cff0c4fa7156f9a5 (patch)
treef3a4a2fbb162e28f7361d409c49fef8aa8f9673b /src/wx/file_dialog.cc
parent9af65a1ea0623f515d17317c9b0e13cc1b2e63f0 (diff)
Fix assertion on trying to select a file (#2737).
Diffstat (limited to 'src/wx/file_dialog.cc')
-rw-r--r--src/wx/file_dialog.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/wx/file_dialog.cc b/src/wx/file_dialog.cc
index 5a530359c..9f547f85a 100644
--- a/src/wx/file_dialog.cc
+++ b/src/wx/file_dialog.cc
@@ -63,6 +63,7 @@ FileDialog::FileDialog(
style
)
, _initial_path_key(initial_path_key)
+ , _multiple(style & wxFD_MULTIPLE)
{
}
@@ -96,9 +97,14 @@ FileDialog::show()
return false;
}
- auto p = paths();
- DCPOMATIC_ASSERT(!p.empty());
- Config::instance()->set_initial_path(_initial_path_key, p[0].parent_path());
+ if (_multiple) {
+ auto p = paths();
+ DCPOMATIC_ASSERT(!p.empty());
+ Config::instance()->set_initial_path(_initial_path_key, p[0].parent_path());
+ } else {
+ Config::instance()->set_initial_path(_initial_path_key, path().parent_path());
+ }
+
return true;
}