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

Side by Side Diff: chrome/installer/util/version.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 unified diff | Download patch
« no previous file with comments | « chrome/browser/upgrade_detector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/installer/util/version.h" 9 #include "chrome/installer/util/version.h"
10 10
(...skipping 20 matching lines...) Expand all
31 && (build_ == other->build_) 31 && (build_ == other->build_)
32 && (patch_ > other->patch_))); 32 && (patch_ > other->patch_)));
33 } 33 }
34 34
35 installer::Version* installer::Version::GetVersionFromString( 35 installer::Version* installer::Version::GetVersionFromString(
36 const string16& version_str) { 36 const string16& version_str) {
37 std::vector<string16> numbers; 37 std::vector<string16> numbers;
38 SplitString(version_str, '.', &numbers); 38 SplitString(version_str, '.', &numbers);
39 39
40 if (numbers.size() != 4) { 40 if (numbers.size() != 4) {
41 LOG(ERROR) << "Invalid version string: " << version_str;
41 return NULL; 42 return NULL;
42 } 43 }
43 44
44 return new Version(StringToInt64(numbers[0]), StringToInt64(numbers[1]), 45 return new Version(StringToInt64(numbers[0]), StringToInt64(numbers[1]),
45 StringToInt64(numbers[2]), StringToInt64(numbers[3])); 46 StringToInt64(numbers[2]), StringToInt64(numbers[3]));
46 } 47 }
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698