Index: net/cert/mock_cert_verifier.cc |
diff --git a/net/cert/mock_cert_verifier.cc b/net/cert/mock_cert_verifier.cc |
index 6ee23d6483c1c885cfaf9036d15af117666145f7..d579d7e29b3de2a095a86c26163c0620747c55c0 100644 |
--- a/net/cert/mock_cert_verifier.cc |
+++ b/net/cert/mock_cert_verifier.cc |
@@ -46,15 +46,17 @@ int MockCertVerifier::Verify(X509Certificate* cert, |
const CompletionCallback& callback, |
scoped_ptr<Request>* out_req, |
const BoundNetLog& net_log) { |
- RuleList::const_iterator it; |
- for (it = rules_.begin(); it != rules_.end(); ++it) { |
- // Check just the server cert. Intermediates will be ignored. |
- if (!it->cert->Equals(cert)) |
- continue; |
- if (!base::MatchPattern(hostname, it->hostname)) |
- continue; |
- *verify_result = it->result; |
- return it->rv; |
+ if (cert) { |
+ RuleList::const_iterator it; |
+ for (it = rules_.begin(); it != rules_.end(); ++it) { |
+ // Check just the server cert. Intermediates will be ignored. |
+ if (!it->cert->Equals(cert)) |
+ continue; |
+ if (!base::MatchPattern(hostname, it->hostname)) |
+ continue; |
+ *verify_result = it->result; |
+ return it->rv; |
+ } |
} |
// Fall through to the default. |