Index: components/cronet/android/cronet_url_request_adapter.cc |
diff --git a/components/cronet/android/cronet_url_request_adapter.cc b/components/cronet/android/cronet_url_request_adapter.cc |
index 253b0a5659b8535c12fb1ac5bb07a21048598598..19437d59c9ec815557188fb4efbfe765550ad5ec 100644 |
--- a/components/cronet/android/cronet_url_request_adapter.cc |
+++ b/components/cronet/android/cronet_url_request_adapter.cc |
@@ -402,7 +402,11 @@ void CronetURLRequestAdapter::ReportError(net::URLRequest* request, |
} |
void CronetURLRequestAdapter::MaybeReportMetrics(JNIEnv* env) const { |
- if (!enable_metrics_) { |
+ // If there was an exception while starting the CronetUrlRequest, there won't |
+ // be a native URLRequest. In this case, the caller gets the exception |
+ // immediately, and the onFailed callback isn't called, so don't report |
+ // metrics either. |
+ if (!enable_metrics_ || !url_request_) { |
return; |
} |
net::LoadTimingInfo metrics; |