From b249f63d2c4ffaa99c516e68a972dca4d2d229ce Mon Sep 17 00:00:00 2001 From: Lingqi Chi Date: Thu, 20 May 2021 04:14:08 +0000 Subject: [PATCH] Prerender: Check SpeculationHostDelegate is non-null before using This CL fixes the issue that SpeculationHostImpl should ensure the delegate pointer is not null before using it. Bug: 1197133 Change-Id: I3a37f86983307571fe6368ff859b481ec518cabb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2907013 Reviewed-by: Tsuyoshi Horo Commit-Queue: Lingqi Chi Cr-Commit-Position: refs/heads/master@{#884858} --- content/browser/speculation_rules/speculation_host_impl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/browser/speculation_rules/speculation_host_impl.cc b/content/browser/speculation_rules/speculation_host_impl.cc index 1b449898809baf..5c210f47ec43bd 100644 --- a/content/browser/speculation_rules/speculation_host_impl.cc +++ b/content/browser/speculation_rules/speculation_host_impl.cc @@ -55,7 +55,8 @@ void SpeculationHostImpl::UpdateSpeculationCandidates( return; // Let `delegate_` process the candidates that it is interested in. - delegate_->ProcessCandidates(candidates); + if (delegate_) + delegate_->ProcessCandidates(candidates); // TODO(crbug.com/1197133): process prerender candidates. }