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

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..2bd324ab2d60f460b7ba2bf7d77eb2698ae09691 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -110,7 +110,10 @@ void DownloadControllerAndroidImpl::PrepareDownloadInfo(
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;
+ }
DownloadInfoAndroid info_android(request);
@@ -137,9 +140,14 @@ void DownloadControllerAndroidImpl::CheckPolicyAndLoadCookies(
const DownloadInfoAndroid& info, int render_process_id,
int render_view_id, const GlobalRequestID& global_id,
const net::CookieList& cookie_list) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
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)) {
@@ -152,12 +160,17 @@ void DownloadControllerAndroidImpl::CheckPolicyAndLoadCookies(
void DownloadControllerAndroidImpl::DoLoadCookies(
const DownloadInfoAndroid& info, int render_process_id,
int render_view_id, const GlobalRequestID& global_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
net::CookieOptions options;
options.set_include_httponly();
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