Fix error when cancelling load of a trusted device certificate.
authorCarl Hetherington <cth@carlh.net>
Tue, 22 Dec 2020 19:26:24 +0000 (20:26 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 22 Dec 2020 19:26:24 +0000 (20:26 +0100)
src/wx/screen_dialog.cc

index 7f309ba66aae9862bce0cae550c3b22fe8575e97..030098920b73e648955b05efb196a6a6ecd62ce5 100644 (file)
@@ -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())));
+                       }
                }
        }