From c90b65a72c50aecc1f1afea1e5fab029b1f7c558 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 15 Jan 2020 16:46:18 +0100 Subject: [PATCH] Fix potential crash in OpenInputStreamWrapper::Open (fixes issue #2808) --- libcef/browser/net_service/stream_reader_url_loader.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libcef/browser/net_service/stream_reader_url_loader.cc b/libcef/browser/net_service/stream_reader_url_loader.cc index 09f985a6d..d95829825 100644 --- a/libcef/browser/net_service/stream_reader_url_loader.cc +++ b/libcef/browser/net_service/stream_reader_url_loader.cc @@ -90,10 +90,11 @@ class OpenInputStreamWrapper void Open(const RequestId& request_id, const network::ResourceRequest& request) { - if (!delegate_->OpenInputStream( - request_id, request, - base::BindOnce(&OpenInputStreamWrapper::OnCallback, - base::WrapRefCounted(this)))) { + // |delegate_| may be null if we were canceled. + if (delegate_ && !delegate_->OpenInputStream( + request_id, request, + base::BindOnce(&OpenInputStreamWrapper::OnCallback, + base::WrapRefCounted(this)))) { OnCallback(nullptr); } }