Skip to content

Commit

Permalink
Fix a null pointer crasher.
Browse files Browse the repository at this point in the history
BUG=84616
Review URL: http://codereview.chromium.org/7054077

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88063 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
michaeln@google.com committed Jun 7, 2011
1 parent 1af8bcf commit f45fe0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions webkit/appcache/appcache_response.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -214,12 +214,16 @@ void AppCacheResponseReader::SetReadRange(int offset, int length) {
void AppCacheResponseReader::OnIOComplete(int result) {
if (result >= 0) {
if (info_buffer_.get()) {
// Allocate and deserialize the http info structure.
// Deserialize the http info structure.
Pickle pickle(buffer_->data(), result);
scoped_ptr<net::HttpResponseInfo> info(new net::HttpResponseInfo);
bool response_truncated = false;
info_buffer_->http_info.reset(new net::HttpResponseInfo);
info_buffer_->http_info->InitFromPickle(pickle, &response_truncated);
if (!info->InitFromPickle(pickle, &response_truncated)) {
InvokeUserCompletionCallback(net::ERR_FAILED);
return;
}
DCHECK(!response_truncated);
info_buffer_->http_info.reset(info.release());

// Also return the size of the response body
DCHECK(entry_);
Expand Down
5 changes: 3 additions & 2 deletions webkit/appcache/appcache_update_job.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -1180,7 +1180,8 @@ void AppCacheUpdateJob::OnResponseInfoLoaded(
const std::string name = "vary";
std::string value;
void* iter = NULL;
if (http_info->headers->RequiresValidation(http_info->request_time,
if (!http_info->headers ||
http_info->headers->RequiresValidation(http_info->request_time,
http_info->response_time,
base::Time::Now()) ||
http_info->headers->EnumerateHeader(&iter, name, &value)) {
Expand Down

0 comments on commit f45fe0a

Please sign in to comment.