Issue #2135 - Follow-up: Check for aElement not being null

This was introduced to Make <link rel="stylesheet"> work in shadow trees.
eElement can, however, be `null` here and if so, it would crash.
This commit is contained in:
Moonchild 2023-03-10 11:44:28 +01:00 committed by roytam1
commit 2249fbdf49

View file

@ -2118,7 +2118,7 @@ Loader::LoadStyleLink(nsIContent* aElement,
PrepareSheet(sheet, aTitle, aMedia, nullptr, nullptr, *aIsAlternate, *aIsExplicitlyEnabled);
if (aElement->HasFlag(NODE_IS_IN_SHADOW_TREE)) {
if (aElement && aElement->HasFlag(NODE_IS_IN_SHADOW_TREE)) {
aElement->GetContainingShadow()->InsertSheet(sheet, aElement);
} else {
rv = InsertSheetInDoc(sheet, aElement, mDocument);