From 2249fbdf495bb0f018445df0db1dcf0d06f6a1d5 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 10 Mar 2023 11:44:28 +0100 Subject: [PATCH] Issue #2135 - Follow-up: Check for aElement not being null This was introduced to Make work in shadow trees. eElement can, however, be `null` here and if so, it would crash. --- layout/style/Loader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 3d1e4826d5..48ca1739dc 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -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);