diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 01:42:36 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 01:42:36 +0000 |
commit | 07d69881dc130c8429f11ff0571711814935d6a5 (patch) | |
tree | 8fec00b9bff6b955d13ba3d8b983ddef1d6f91ee | |
parent | 81fa4e0c2a34653fa278ee324ac6f38a3d793335 (diff) | |
download | chromium_src-07d69881dc130c8429f11ff0571711814935d6a5.zip chromium_src-07d69881dc130c8429f11ff0571711814935d6a5.tar.gz chromium_src-07d69881dc130c8429f11ff0571711814935d6a5.tar.bz2 |
Fix crash because error_label_ wasn't being set to NULL in
non-official builds and wasn't checked for NULL before usage.
I was tempted to use #ifdefs for all this, but that really made the
code ugly. So, we get the if check.
I'm TBRing since this is giving some instability on the bots.
BUG=102725
TEST=none
TBR=ben@chromium.org,finnur@chromium.org
R=ben@chromium.org,finnur@chromium.org
Review URL: http://codereview.chromium.org/8386069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108400 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/accessibility/browser_views_accessibility_browsertest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/about_chrome_view.cc | 19 | ||||
-rw-r--r-- | chrome/browser/ui/views/about_chrome_view.h | 1 |
3 files changed, 13 insertions, 9 deletions
diff --git a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc index 70125d9..e54666c 100644 --- a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc +++ b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc @@ -242,7 +242,7 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, } IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, - FAILS_TestAboutChromeViewAccObj) { + TestAboutChromeViewAccObj) { LOG(ERROR) << "Starting TestAboutChromeViewAccObj test\n"; // Firstly, test that the WindowDelegate got updated. diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index f345b5a..10a1c4f 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -99,6 +99,7 @@ AboutChromeView::AboutChromeView(Profile* profile) chromium_url_(NULL), open_source_url_(NULL), terms_of_service_url_(NULL), + error_label_(NULL), restart_button_visible_(false), chromium_url_appears_first_(true), text_direction_is_rtl_(false) { @@ -344,12 +345,14 @@ void AboutChromeView::Layout() { // And the error label at the bottom of the main content. This does not fit on // screen until EnlargeWindowSizeIfNeeded has been called (which happens when // an error is returned from Google Update). - sz.set_height(error_label_->GetHeightForWidth(sz.width())); - error_label_->SetBounds(main_text_label_->bounds().x(), - main_text_label_->bounds().y() + - main_text_label_->height() + - kErrorLabelVerticalSpacing, - sz.width(), sz.height()); + if (error_label_) { + sz.set_height(error_label_->GetHeightForWidth(sz.width())); + error_label_->SetBounds(main_text_label_->bounds().x(), + main_text_label_->bounds().y() + + main_text_label_->height() + + kErrorLabelVerticalSpacing, + sz.width(), sz.height()); + } // Get the y-coordinate of our parent so we can position the text left of the // buttons at the bottom. @@ -726,7 +729,7 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, } case UPGRADE_ERROR: { UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error")); - if (!error_message.empty()) { + if (!error_message.empty() && error_label_) { error_label_->SetText( l10n_util::GetStringFUTF16(IDS_ABOUT_BOX_ERROR_DURING_UPDATE_CHECK, error_message)); @@ -769,7 +772,7 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, } int AboutChromeView::EnlargeWindowSizeIfNeeded() { - if (error_label_->GetText().empty()) + if (!error_label_ || error_label_->GetText().empty()) return 0; // This will enlarge the window each time the function is called, which is diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h index b051542..e8ef825 100644 --- a/chrome/browser/ui/views/about_chrome_view.h +++ b/chrome/browser/ui/views/about_chrome_view.h @@ -109,6 +109,7 @@ class AboutChromeView : public views::DialogDelegateView, gfx::Rect open_source_url_rect_; views::Link* terms_of_service_url_; gfx::Rect terms_of_service_url_rect_; + // NULL in non-official builds. views::Label* error_label_; // UI elements we add to the parent view. scoped_ptr<views::Throbber> throbber_; |