diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 2df384e7cc0..a324f80eb75 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -2006,6 +2006,7 @@ EventStateManager::GetContentViewer(nsIContentViewer** aCv) nsCOMPtr focusedWindow; fm->GetFocusedWindow(getter_AddRefs(focusedWindow)); + if (!focusedWindow) return NS_ERROR_FAILURE; auto* ourWindow = nsPIDOMWindowOuter::From(focusedWindow);