From 2811d30051ebd7958cbc256da631adad18a0aaa6 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 14 Apr 2024 17:48:12 +0200 Subject: [PATCH] [DOM] Add nullcheck on mDoc in GetEventTargetParent --- dom/base/nsGlobalWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 75d3c1861a..3ef2f6cd8c 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -3545,7 +3545,9 @@ nsGlobalWindow::GetEventTargetParent(EventChainPreVisitor& aVisitor) aVisitor.mCanHandle = true; // Middle/right click shouldn't dispatch click event, use auxclick to instead. - if (mDoc->IsXULDocument()) { + // Note: mDoc should always exist here, but check just in case someone yanked + // it out from under us. + if (mDoc && mDoc->IsXULDocument()) { aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119 } if (msg == eResize && aVisitor.mEvent->IsTrusted()) {