diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 05:04:20 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 05:04:20 +0000 |
commit | 6fd3c05c8b1f2734a7347e0fba6abe0fb39b9e76 (patch) | |
tree | dbf141ed6fa492029c8b57d967d38c20a47db0c2 /ui | |
parent | 6c1667724ec6420e06af0ff969338826fa83a882 (diff) | |
download | chromium_src-6fd3c05c8b1f2734a7347e0fba6abe0fb39b9e76.zip chromium_src-6fd3c05c8b1f2734a7347e0fba6abe0fb39b9e76.tar.gz chromium_src-6fd3c05c8b1f2734a7347e0fba6abe0fb39b9e76.tar.bz2 |
Fix a FORWARD_NULL defect reported by Coverity.
We never construct a ScrollView object with a null horiz_sb_
or vert_sb_ member, and we already dereference horiz_sb_ and
vert_sb_ without null checking in many places (including the
destructor), so all the null checks for horiz_sb_ and vert_sb_
are unnecessary.
Original review URL: http://codereview.chromium.org/155980/
R=ben@chromium.org
BUG=17101
TEST=none
Review URL: http://codereview.chromium.org/8827007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/scroll_view.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc index 8d67d28..72b601a 100644 --- a/ui/views/controls/scroll_view.cc +++ b/ui/views/controls/scroll_view.cc @@ -262,17 +262,15 @@ gfx::Rect ScrollView::GetVisibleRect() const { return gfx::Rect(); const int x = - (horiz_sb_ && horiz_sb_->IsVisible()) ? horiz_sb_->GetPosition() : 0; + horiz_sb_->IsVisible() ? horiz_sb_->GetPosition() : 0; const int y = - (vert_sb_ && vert_sb_->IsVisible()) ? vert_sb_->GetPosition() : 0; + vert_sb_->IsVisible() ? vert_sb_->GetPosition() : 0; return gfx::Rect(x, y, viewport_->width(), viewport_->height()); } void ScrollView::ScrollContentsRegionToBeVisible(const gfx::Rect& rect) { - if (!contents_ || ((!horiz_sb_ || !horiz_sb_->IsVisible()) && - (!vert_sb_ || !vert_sb_->IsVisible()))) { + if (!contents_ || (!horiz_sb_->IsVisible() && !vert_sb_->IsVisible())) return; - } // Figure out the maximums for this scroll view. const int contents_max_x = |