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

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: Fix dup check of view_ 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..f0f8e91e54831dc1bfe815e2513c53c784a43a6b 100644
--- a/ui/views/accessibility/native_view_accessibility_win.cc
+++ b/ui/views/accessibility/native_view_accessibility_win.cc
@@ -253,7 +253,7 @@ STDMETHODIMP NativeViewAccessibilityWin::accHitTest(
if (!child)
return E_INVALIDARG;
- if (!view_)
+ if (!view_ || !view_->GetWidget())
return E_FAIL;
// If this is a root view, our widget might have child widgets.
@@ -461,7 +461,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child,
if (var_child.vt != VT_I4 || !disp_child)
return E_INVALIDARG;
- if (!view_)
+ if (!view_ || !view_->GetWidget())
return E_FAIL;
LONG child_id = V_I4(&var_child);
@@ -530,10 +530,10 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child,
}
STDMETHODIMP NativeViewAccessibilityWin::get_accChildCount(LONG* child_count) {
- if (!child_count || !view_)
+ if (!child_count)
return E_INVALIDARG;
- if (!view_)
+ if (!view_ || !view_->GetWidget())
return E_FAIL;
*child_count = view_->child_count();
@@ -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