Skip to content

Commit

Permalink
URLRequestHttpJob: don't crash in GetMimeType
Browse files Browse the repository at this point in the history
GetMimeType can crash if there is a valid response info without a valid set of
headers, so check that the headers are not null.

BUG=459243

Review URL: https://codereview.chromium.org/937523002

Cr-Commit-Position: refs/heads/master@{#316693}
  • Loading branch information
ellyjones authored and Commit bot committed Feb 17, 2015
1 parent b7c86e3 commit 0e9d5e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/url_request/url_request_http_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,10 @@ bool URLRequestHttpJob::GetMimeType(std::string* mime_type) const {
if (!response_info_)
return false;

return GetResponseHeaders()->GetMimeType(mime_type);
HttpResponseHeaders* headers = GetResponseHeaders();
if (!headers)
return false;
return headers->GetMimeType(mime_type);
}

bool URLRequestHttpJob::GetCharset(std::string* charset) {
Expand Down

0 comments on commit 0e9d5e8

Please sign in to comment.