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

Unified Diff: chrome/browser/android/offline_pages/offline_page_bridge.cc

Issue 2007113007: Offline Pages: Add NULL-checks for when the model is NULL (incognito mode) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 months 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: chrome/browser/android/offline_pages/offline_page_bridge.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.cc b/chrome/browser/android/offline_pages/offline_page_bridge.cc
index 6c229f4eb013f64f7feedee2de1999de037c95c1..62116b938c6208bf4638727fbe8aa30d342a5fb1 100644
--- a/chrome/browser/android/offline_pages/offline_page_bridge.cc
+++ b/chrome/browser/android/offline_pages/offline_page_bridge.cc
@@ -161,15 +161,20 @@ static ScopedJavaLocalRef<jobject> GetOfflinePageBridgeForProfile(
const JavaParamRef<jclass>& jcaller,
const JavaParamRef<jobject>& j_profile) {
Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
+
OfflinePageModel* offline_page_model =
OfflinePageModelFactory::GetForBrowserContext(profile);
+ if (offline_page_model == nullptr)
+ return ScopedJavaLocalRef<jobject>();
+
OfflinePageBridge* bridge = static_cast<OfflinePageBridge*>(
offline_page_model->GetUserData(kOfflinePageBridgeKey));
if (!bridge) {
bridge = new OfflinePageBridge(env, profile, offline_page_model);
offline_page_model->SetUserData(kOfflinePageBridgeKey, bridge);
}
+
return ScopedJavaLocalRef<jobject>(bridge->java_ref());
}
« 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