From 151f0d4a679e581140b40187a30ea1e31b624a00 Mon Sep 17 00:00:00 2001 From: "wtc@chromium.org" Date: Wed, 22 Jul 2009 18:32:45 +0000 Subject: Fix a FORWARD_NULL defect reported by Coverity. In ChromeClientImpl::focus(), we need to do a null check for 'delegate' before calling delegate->FocusAccessibilityObject(). R=klink BUG=http://crbug.com/17101 TEST=none Review URL: http://codereview.chromium.org/159182 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21296 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/chrome_client_impl.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'webkit') diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index 1d2d561..18b0544 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -152,28 +152,28 @@ float ChromeClientImpl::scaleFactor() { void ChromeClientImpl::focus() { WebViewDelegate* delegate = webview_->delegate(); - if (delegate) + if (delegate) { delegate->didFocus(); - // If accessibility is enabled, we should notify assistive technology that the - // active AccessibilityObject changed. - WebCore::Document* doc = webview_->GetFocusedWebCoreFrame()->document(); + // If accessibility is enabled, we should notify assistive technology that + // the active AccessibilityObject changed. + WebCore::Document* doc = webview_->GetFocusedWebCoreFrame()->document(); - if (doc && doc->axObjectCache()->accessibilityEnabled()) { - WebCore::Node* focused_node = webview_->GetFocusedNode(); + if (doc && doc->axObjectCache()->accessibilityEnabled()) { + WebCore::Node* focused_node = webview_->GetFocusedNode(); - if (!focused_node) { - // Could not retrieve focused Node. - return; - } + if (!focused_node) { + // Could not retrieve focused Node. + return; + } - // Retrieve the focused AccessibilityObject. - WebCore::AccessibilityObject* focused_acc_obj = - doc->axObjectCache()->getOrCreate(focused_node->renderer()); + // Retrieve the focused AccessibilityObject. + WebCore::AccessibilityObject* focused_acc_obj = + doc->axObjectCache()->getOrCreate(focused_node->renderer()); - // Alert assistive technology that focus changed. - if (focused_acc_obj) { - delegate->FocusAccessibilityObject(focused_acc_obj); + // Alert assistive technology that focus changed. + if (focused_acc_obj) + delegate->FocusAccessibilityObject(focused_acc_obj); } } } -- cgit v1.1