Bug 941888 - Add null check to nsXULElement::GetWindowWidget(). r=mats, a=bajaj
authorOlli Pettay <bugs@pettay.fi>
Fri, 22 Nov 2013 10:40:31 -0500
changeset 167580 644e577111a07f197ebd1b96b8b0cb7b030d8b6d
parent 167579 0d728d9700dfd4bb917ddb27d0b32dc1b22feb35
child 167581 39c91b039dcdae6fd47d53ae6e0c4a83a7386451
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats, bajaj
bugs941888
milestone27.0a2
Bug 941888 - Add null check to nsXULElement::GetWindowWidget(). r=mats, a=bajaj
content/xul/content/src/nsXULElement.cpp
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -1774,17 +1774,17 @@ nsXULElement::HideWindowChrome(bool aSho
 }
 
 nsIWidget*
 nsXULElement::GetWindowWidget()
 {
     nsIDocument* doc = GetCurrentDoc();
 
     // only top level chrome documents can set the titlebar color
-    if (doc->IsRootDisplayDocument()) {
+    if (doc && doc->IsRootDisplayDocument()) {
         nsCOMPtr<nsISupports> container = doc->GetContainer();
         nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
         if (baseWindow) {
             nsCOMPtr<nsIWidget> mainWidget;
             baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
             return mainWidget;
         }
     }