From 30e8509fd25aaacd3479f67b8d1b2442aafd3c7f Mon Sep 17 00:00:00 2001 From: roytam1 Date: Mon, 11 Apr 2022 23:50:02 +0800 Subject: [PATCH] ported from esr91: Bug 1761026 - Add a null check for FetchDriver::mResponse, r=necko-reviewers,dragana a=dmeehan (3b54d6b5) --- dom/fetch/FetchDriver.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index 79bd5a0e39..35d929c89d 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -721,10 +721,14 @@ FetchDriver::OnDataAvailable(nsIRequest* aRequest, } } + if (!mResponse) { + MOZ_ASSERT(false); + return NS_ERROR_UNEXPECTED; + } + // Explicitly initialized to 0 because in some cases nsStringInputStream may // not write to aRead. uint32_t aRead = 0; - MOZ_ASSERT(mResponse); MOZ_ASSERT(mPipeOutputStream); // From "Main Fetch" step 17: SRI-part2.