commit | 99221611fa9bda55b067903d78607a43691b4043 | [log] [tgz] |
---|---|---|
author | Ted Choc <tedchoc@chromium.org> | Fri Mar 08 18:54:31 2024 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Mar 08 18:54:31 2024 |
tree | a821c899ecb439658deb81558c32dca4fdd5f8f5 | |
parent | a09c89f499f1ebac05474d98d34793bcf9ed3070 [diff] |
Crash loudly if passed a null/destroyed profile to SyncServiceFactory.getForProfile. (cherry picked from commit 9aa74a6030414f43982b6e45c8f100ad301fe811) Bug: 327687076 Change-Id: Id750b58d42b3a1a81620eda0b5d400356ce0f009 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5341935 Commit-Queue: Ted Choc <tedchoc@chromium.org> Reviewed-by: Theresa Sullivan <twellington@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#1268210} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5356561 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/branch-heads/6312@{#479} Cr-Branched-From: 6711dcdae48edaf98cbc6964f90fac85b7d9986e-refs/heads/main@{#1262506}
diff --git a/chrome/browser/sync/android/java/src/org/chromium/chrome/browser/sync/SyncServiceFactory.java b/chrome/browser/sync/android/java/src/org/chromium/chrome/browser/sync/SyncServiceFactory.java index 6442eae..0bd68cf 100644 --- a/chrome/browser/sync/android/java/src/org/chromium/chrome/browser/sync/SyncServiceFactory.java +++ b/chrome/browser/sync/android/java/src/org/chromium/chrome/browser/sync/SyncServiceFactory.java
@@ -31,6 +31,11 @@ public static @Nullable SyncService getForProfile(Profile profile) { ThreadUtils.assertOnUiThread(); if (sSyncServiceForTest != null) return sSyncServiceForTest; + if (profile == null) { + throw new IllegalArgumentException( + "Attempting to access the SyncService with a null profile"); + } + profile.ensureNativeInitialized(); return SyncServiceFactoryJni.get().getForProfile(profile); }