From 260e924ce6c84d08bfc62ba458e49b53716cff6e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 26 Jul 2015 19:09:36 +0100 Subject: [PATCH] Catch exceptions when loading KDMs. --- src/wx/content_menu.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 0adbc775a..2218c5c08 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -36,6 +36,7 @@ using std::cout; using std::vector; +using std::exception; using boost::shared_ptr; using boost::weak_ptr; using boost::dynamic_pointer_cast; @@ -312,7 +313,12 @@ ContentMenu::kdm () wxFileDialog* d = new wxFileDialog (_parent, _("Select KDM")); if (d->ShowModal() == wxID_OK) { - dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ())))); + try { + dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ())))); + } catch (exception& e) { + error_dialog (_parent, wxString::Format (_("Could not load KDM (%s)"), e.what ())); + } + shared_ptr film = _film.lock (); DCPOMATIC_ASSERT (film); film->examine_content (dcp); -- 2.30.2