From e026ba2c11f16fe2d486acdd489050538e66fece Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 22 Dec 2020 20:26:24 +0100 Subject: [PATCH] Fix error when cancelling load of a trusted device certificate. --- src/wx/screen_dialog.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc index 7f309ba66..030098920 100644 --- a/src/wx/screen_dialog.cc +++ b/src/wx/screen_dialog.cc @@ -69,12 +69,13 @@ public: void load_certificate () { wxFileDialog* d = new wxFileDialog (this, _("Trusted Device certificate")); - d->ShowModal (); - try { - _certificate = dcp::Certificate(dcp::file_to_string(wx_to_std(d->GetPath()))); - _thumbprint->SetValue (std_to_wx(_certificate->thumbprint())); - } catch (dcp::MiscError& e) { - error_dialog (this, wxString::Format(_("Could not load certficate (%s)"), std_to_wx(e.what()))); + if (d->ShowModal() == wxID_OK) { + try { + _certificate = dcp::Certificate(dcp::file_to_string(wx_to_std(d->GetPath()))); + _thumbprint->SetValue (std_to_wx(_certificate->thumbprint())); + } catch (dcp::MiscError& e) { + error_dialog (this, wxString::Format(_("Could not load certficate (%s)"), std_to_wx(e.what()))); + } } } -- 2.30.2