Fix BodySnifferURLLoader::Cancel() crash on invalid WeakPtr dereference (#34003)

Add a null check for throttle_ before dereferencing in Cancel(),
consistent with existing guards in OnComplete() and CompleteSniffing().

Resolves: https://github.com/brave/brave-browser/issues/52931
This commit is contained in:
Serg
2026-02-18 12:59:01 +07:00
committed by GitHub
parent 3bbad4d461
commit 88a3dd68f5
@@ -450,6 +450,10 @@ void BodySnifferURLLoader::ForwardBodyToClient() {
}
void BodySnifferURLLoader::Cancel() {
if (!throttle_) {
Abort();
return;
}
throttle_->Cancel();
}