Skip to content

Commit 64bef94

Browse files
committed
[Merge M68]Check if weak_system_store object is valid before using it.
This may have caused the crash in crbug/847026 Bug: 847026 Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet Change-Id: Ia3b4a4a756aec2898f8933173a61bdb097f935b5 Reviewed-on: https://chromium-review.googlesource.com/1076672 Reviewed-by: Eugene But <[email protected]> Commit-Queue: Mohammad Refaat <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#562573}(cherry picked from commit 2e6de02) Reviewed-on: https://chromium-review.googlesource.com/1081068 Cr-Commit-Position: refs/branch-heads/3440@{#69} Cr-Branched-From: 010ddcf-refs/heads/master@{#561733}
1 parent a6558a1 commit 64bef94

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ios/net/cookies/cookie_store_ios.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,18 @@ bool HasExplicitDomain(const std::string& cookie_line) {
556556
system_store_->GetWeakPtr();
557557
system_store_->GetAllCookiesAsync(
558558
base::BindBlockArc(^(NSArray<NSHTTPCookie*>* cookies) {
559+
if (!weak_system_store) {
560+
if (!shared_callback.is_null())
561+
std::move(shared_callback).Run(0);
562+
return;
563+
}
559564
int to_delete_count = 0;
560565
for (NSHTTPCookie* cookie in cookies) {
561566
base::Time creation_time =
562567
weak_system_store->GetCookieCreationTime(cookie);
563568
CanonicalCookie cc =
564569
CanonicalCookieFromSystemCookie(cookie, creation_time);
565-
if (weak_system_store && shared_delete_info.Matches(cc)) {
570+
if (shared_delete_info.Matches(cc)) {
566571
weak_system_store->DeleteCookieAsync(
567572
cookie, SystemCookieStore::SystemCookieCallback());
568573
to_delete_count++;

0 commit comments

Comments
 (0)