From ece0618eccd988260842ea233e9a784c4b416b45 Mon Sep 17 00:00:00 2001 From: Oriol Date: Thu, 1 Jun 2017 06:45:00 -0400 Subject: [PATCH] Bug 1369246 - Check if window pointer is null before attempting to call a method. r=baku --- dom/base/nsContentUtils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index e4c42238aa54..5fc05a7453ec 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -4449,12 +4449,13 @@ nsContentUtils::GetSubdocumentWithOuterWindowId(nsIDocument *aDocument, return nullptr; } - nsCOMPtr window = nsGlobalWindow::GetOuterWindowWithId(aOuterWindowId)->AsOuter(); + RefPtr window = nsGlobalWindow::GetOuterWindowWithId(aOuterWindowId); if (!window) { return nullptr; } - nsCOMPtr foundDoc = window->GetDoc(); + nsCOMPtr outerWindow = window->AsOuter(); + nsCOMPtr foundDoc = outerWindow->GetDoc(); if (nsContentUtils::ContentIsCrossDocDescendantOf(foundDoc, aDocument)) { // Note that ContentIsCrossDocDescendantOf will return true if // foundDoc == aDocument.