Bug 716589 - crash nsDocAccessible::GetNativeWindow. r=tbsaunde
authorDavid Bolter <dbolter@mozilla.com>
Tue, 10 Jan 2012 13:52:14 -0500
changeset 85364 1ed2eb54e546ff460a17141692cd46beb45d7655
parent 85363 1bdcd84ae727f884a8f54bf442a387f61a86765c
child 85365 afa049904ea67099a58d1d63d4f8ae3a8d37827b
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs716589
milestone12.0a1
Bug 716589 - crash nsDocAccessible::GetNativeWindow. r=tbsaunde
accessible/src/base/nsDocAccessible.cpp
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1273,23 +1273,28 @@ nsDocAccessible::HandleAccEvent(AccEvent
 
 ////////////////////////////////////////////////////////////////////////////////
 // Public members
 
 void*
 nsDocAccessible::GetNativeWindow() const
 {
   nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
+  if (!shell)
+    return nsnull;
+
   nsIViewManager* vm = shell->GetViewManager();
-  if (vm) {
-    nsCOMPtr<nsIWidget> widget;
-    vm->GetRootWidget(getter_AddRefs(widget));
-    if (widget)
-      return widget->GetNativeData(NS_NATIVE_WINDOW);
-  }
+  if (!vm)
+    return nsnull;
+
+  nsCOMPtr<nsIWidget> widget;
+  vm->GetRootWidget(getter_AddRefs(widget));
+  if (widget)
+    return widget->GetNativeData(NS_NATIVE_WINDOW);
+
   return nsnull;
 }
 
 nsAccessible*
 nsDocAccessible::GetAccessibleByUniqueIDInSubtree(void* aUniqueID)
 {
   nsAccessible* child = GetAccessibleByUniqueID(aUniqueID);
   if (child)