Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Unified Diff: ui/views/accessibility/native_view_accessibility_win.cc

Issue 57833004: Always check if View::GetWidget() is NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698