]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix crash when request failed
authorCheng Zhao <zcbenz@gmail.com>
Wed, 6 Jan 2016 13:07:07 +0000 (21:07 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 6 Jan 2016 13:07:07 +0000 (21:07 +0800)
atom/browser/net/url_request_fetch_job.cc

index 8ffb6df0122f683fd6b9c16fd7d926bba1e64ce6..6f4182901752c82c583db256dedfb368976b5327 100644 (file)
@@ -205,7 +205,7 @@ bool URLRequestFetchJob::ReadRawData(net::IOBuffer* dest,
 }
 
 bool URLRequestFetchJob::GetMimeType(std::string* mime_type) const {
-  if (!response_info_)
+  if (!response_info_ || !response_info_->headers)
     return false;
 
   return response_info_->headers->GetMimeType(mime_type);
@@ -217,7 +217,7 @@ void URLRequestFetchJob::GetResponseInfo(net::HttpResponseInfo* info) {
 }
 
 int URLRequestFetchJob::GetResponseCode() const {
-  if (!response_info_)
+  if (!response_info_ || !response_info_->headers)
     return -1;
 
   return response_info_->headers->response_code();