Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1534)

Unified Diff: content/browser/android/download_controller_android_impl.cc

Issue 11592012: Fix NULL pointer usage, it is P1 crash bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/download_controller_android_impl.cc
diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc
index 4da0615494ec2c51138a96bec41fa0f0a6484a7d..1e588bce7766fc69adb4a26f38d28c6a159f04d3 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -111,6 +111,10 @@ void DownloadControllerAndroidImpl::PrepareDownloadInfo(
net::URLRequest* request =
ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id);
DCHECK(request) << "Request to download not found.";
Philippe 2012/12/17 15:20:06 Nit: I would remove these DCHECKs now that we are
felipeg 2012/12/17 15:21:33 Done.
+ if (!request) {
+ LOG(ERROR) << "Request to download not found.";
+ return;
+ }
DownloadInfoAndroid info_android(request);
@@ -140,6 +144,10 @@ void DownloadControllerAndroidImpl::CheckPolicyAndLoadCookies(
net::URLRequest* request =
ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id);
DCHECK(request) << "Request to download not found.";
+ if (!request) {
+ LOG(ERROR) << "Request to download not found.";
+ return;
+ }
if (request->context()->network_delegate()->CanGetCookies(
*request, cookie_list)) {
@@ -158,6 +166,10 @@ void DownloadControllerAndroidImpl::DoLoadCookies(
net::URLRequest* request =
ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id);
DCHECK(request) << "Request to download not found.";
+ if (!request) {
+ LOG(ERROR) << "Request to download not found.";
+ return;
+ }
request->context()->cookie_store()->GetCookiesWithOptionsAsync(
info.url, options,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698