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

Unified Diff: chrome/browser/upgrade_detector.cc

Issue 2813005: Avoid a crash when current version info is not obtainable. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: oops Created 10 years, 6 months 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 | chrome/installer/util/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/upgrade_detector.cc
diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc
index ae92c99692bdc8a42e968921eb47d5815086aaf9..49db0ce83e1b7a0668fc20826d3d92e8ad191e58 100644
--- a/chrome/browser/upgrade_detector.cc
+++ b/chrome/browser/upgrade_detector.cc
@@ -102,10 +102,19 @@ class DetectUpgradeTask : public Task {
NOTREACHED() << "Failed to get current file version";
return;
}
- scoped_ptr<Version> running_version(Version::GetVersionFromString(
- WideToUTF16(version->file_version())));
- if (installed_version->IsHigherThan(running_version.get())) {
+ scoped_ptr<Version> running_version(
+ Version::GetVersionFromString(WideToUTF16(version->file_version())));
+ if (running_version.get() == NULL) {
+ NOTREACHED() << "Failed to parse version info";
+ return;
+ }
+
+ // |installed_version| may be NULL when the user downgrades on Linux (by
+ // switching from dev to beta channel, for example). The user needs a
+ // restart in this case as well. See http://crbug.com/46547
+ if (!installed_version.get() ||
+ installed_version->IsHigherThan(running_version.get())) {
ChromeThread::PostTask(ChromeThread::UI, FROM_HERE,
upgrade_detected_task_);
upgrade_detected_task_ = NULL;
« no previous file with comments | « no previous file | chrome/installer/util/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698