Issue #2135 - Follow-up: Ensure document is not null in nsImageLoadingContent::BindToTree

This commit is contained in:
FranklinDM 2023-03-08 12:08:39 +08:00 • committed by roytam1
commit cfef3fa487

View file

@ -1431,13 +1431,15 @@ nsImageLoadingContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
bool aCompileEventHandlers) bool aCompileEventHandlers)
{ {
// We may be getting connected and our image should be tracked. // We may be getting connected and our image should be tracked.
if (GetOurCurrentDoc()) { nsCOMPtr<nsIDocument> doc = GetOurCurrentDoc();
TrackImage(mCurrentRequest); if (!doc)
TrackImage(mPendingRequest); return;
}
TrackImage(mCurrentRequest);
TrackImage(mPendingRequest);
if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD) if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
aDocument->BlockOnload(); doc->BlockOnload();
} }
void void