summaryrefslogtreecommitdiff
path: root/src
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
parent9af65a1ea0623f515d17317c9b0e13cc1b2e63f0 (diff)
Fix assertion on trying to select a file (#2737).
Diffstat (limited to 'src')
-rw-r--r--src/wx/file_dialog.cc12
-rw-r--r--src/wx/file_dialog.h1
2 files changed, 10 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;
}
diff --git a/src/wx/file_dialog.h b/src/wx/file_dialog.h
index ad8f68aa1..a87c65395 100644
--- a/src/wx/file_dialog.h
+++ b/src/wx/file_dialog.h
@@ -52,5 +52,6 @@ public:
private:
std::string _initial_path_key;
+ bool _multiple;
};