summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-06-03 21:18:36 +0200
committerCarl Hetherington <cth@carlh.net>2023-06-05 00:48:55 +0200
commitc6a188f0aeb65268b94a1dbfed670afc4c3066be (patch)
treee674b6c274f992bd3e4c9010246966d65ae2b5fa
parent05b9552035be66d9cbf10e51e636845dcf49f30f (diff)
Cope with bad DCPs better in the editor.
-rw-r--r--src/tools/dcpomatic_editor.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tools/dcpomatic_editor.cc b/src/tools/dcpomatic_editor.cc
index 69fbe4643..eb968b1e8 100644
--- a/src/tools/dcpomatic_editor.cc
+++ b/src/tools/dcpomatic_editor.cc
@@ -328,10 +328,15 @@ public:
void load_dcp (boost::filesystem::path path)
{
- _notebook->DeleteAllPages();
+ try {
+ _dcp = dcp::DCP(path);
+ _dcp->read();
+ } catch (std::runtime_error& e) {
+ error_dialog(this, _("Could not load DCP"), std_to_wx(e.what()));
+ return;
+ }
- _dcp = dcp::DCP(path);
- _dcp->read();
+ _notebook->DeleteAllPages();
for (auto cpl: _dcp->cpls()) {
_notebook->AddPage(new CPLPanel(_notebook, cpl), wx_to_std(cpl->annotation_text().get_value_or(cpl->id())));
}