Index: ui/views/accessibility/native_view_accessibility_win.cc |
diff --git a/ui/views/accessibility/native_view_accessibility_win.cc b/ui/views/accessibility/native_view_accessibility_win.cc |
index 7aa92a2a13cfb33da5d81cbfb8c4aff6c0026237..358fc17b872ebf98e98871eb11d60fb2f0efaaa5 100644 |
--- a/ui/views/accessibility/native_view_accessibility_win.cc |
+++ b/ui/views/accessibility/native_view_accessibility_win.cc |
@@ -258,7 +258,7 @@ STDMETHODIMP NativeViewAccessibilityWin::accHitTest( |
// If this is a root view, our widget might have child widgets. |
// Search child widgets first, since they're on top in the z-order. |
- if (view_->GetWidget()->GetRootView() == view_) { |
+ if (view_->GetWidget() && view_->GetWidget()->GetRootView() == view_) { |
std::vector<Widget*> child_widgets; |
PopulateChildWidgetVector(&child_widgets); |
for (size_t i = 0; i < child_widgets.size(); ++i) { |
@@ -473,7 +473,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child, |
// If this is a root view, our widget might have child widgets. Include |
std::vector<Widget*> child_widgets; |
- if (view_->GetWidget()->GetRootView() == view_) |
+ if (view_->GetWidget() && view_->GetWidget()->GetRootView() == view_) |
PopulateChildWidgetVector(&child_widgets); |
int child_widget_count = static_cast<int>(child_widgets.size()); |
@@ -540,7 +540,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChildCount(LONG* child_count) { |
// If this is a root view, our widget might have child widgets. Include |
// them, too. |
- if (view_->GetWidget()->GetRootView() == view_) { |
+ if (view_->GetWidget() && view_->GetWidget()->GetRootView() == view_) { |
std::vector<Widget*> child_widgets; |
PopulateChildWidgetVector(&child_widgets); |
*child_count += child_widgets.size(); |
@@ -1392,6 +1392,9 @@ LONG NativeViewAccessibilityWin::FindBoundary( |
void NativeViewAccessibilityWin::PopulateChildWidgetVector( |
std::vector<Widget*>* result_child_widgets) { |
const Widget* widget = view()->GetWidget(); |
+ if (!widget) |
+ return; |
+ |
std::set<Widget*> child_widgets; |
Widget::GetAllChildWidgets(widget->GetNativeView(), &child_widgets); |
Widget::GetAllOwnedWidgets(widget->GetNativeView(), &child_widgets); |