Fix Christie certificate download when first try fails.
authorCarl Hetherington <cth@carlh.net>
Tue, 22 Dec 2020 18:58:02 +0000 (19:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 22 Dec 2020 18:58:02 +0000 (19:58 +0100)
src/wx/christie_certificate_panel.cc

index c4584ed3c304f8a096664571f1eca431a61d9c3f..ab131e015cf0ba95135cef0693e38e2b2b743634 100644 (file)
@@ -62,6 +62,7 @@ ChristieCertificatePanel::do_download ()
        string const url = String::compose ("%1F-IMB/F-IMB_%2_sha256.pem", prefix, serial);
 
        optional<string> all_errors;
+       bool ok = true;
 
        optional<string> error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1));
        if (error) {
@@ -72,15 +73,16 @@ ChristieCertificatePanel::do_download ()
                error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1));
                if (error) {
                        *all_errors += "\n" + *error;
+                       ok = false;
                }
        }
 
-       if (all_errors) {
-               _dialog->message()->SetLabel(wxT(""));
-               error_dialog (this, std_to_wx(*all_errors));
-       } else {
+       if (ok) {
                _dialog->message()->SetLabel (_("Certificate downloaded"));
                _dialog->setup_sensitivity ();
+       } else {
+               _dialog->message()->SetLabel(wxT(""));
+               error_dialog (this, std_to_wx(*all_errors));
        }
 }