Index: chrome/installer/util/shell_util.cc |
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc |
index dc51efdc019b401a0d3f1778743c6f5726c9a5d6..9b834a01d199fbb1b4d6433a093963908f881b08 100644 |
--- a/chrome/installer/util/shell_util.cc |
+++ b/chrome/installer/util/shell_util.cc |
@@ -704,8 +704,8 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, |
RegKey key(is_per_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, |
dist->GetStateKey().c_str(), KEY_QUERY_VALUE | KEY_WOW64_32KEY); |
base::string16 uninstall_string; |
- if (key.ReadValue(installer::kUninstallStringField, &uninstall_string) == |
- ERROR_SUCCESS) { |
+ if (key.Valid() && key.ReadValue(installer::kUninstallStringField, |
+ &uninstall_string) == ERROR_SUCCESS) { |
exe_path = base::FilePath(uninstall_string); |
} |
} |
@@ -849,14 +849,15 @@ bool QuickIsChromeRegistered(const base::FilePath& chrome_exe, |
base::string16 hkcu_value; |
// If |reg_key| is present in HKCU, assert that it points to |chrome_exe|. |
// Otherwise, fall back on an HKLM lookup below. |
- if (key_hkcu.ReadValue(L"", &hkcu_value) == ERROR_SUCCESS) |
+ if (key_hkcu.Valid() && |
+ key_hkcu.ReadValue(L"", &hkcu_value) == ERROR_SUCCESS) |
return InstallUtil::ProgramCompare(chrome_exe).Evaluate(hkcu_value); |
} |
// Assert that |reg_key| points to |chrome_exe| in HKLM. |
const RegKey key_hklm(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_QUERY_VALUE); |
base::string16 hklm_value; |
- if (key_hklm.ReadValue(L"", &hklm_value) == ERROR_SUCCESS) |
+ if (key_hklm.Valid() && key_hklm.ReadValue(L"", &hklm_value) == ERROR_SUCCESS) |
return InstallUtil::ProgramCompare(chrome_exe).Evaluate(hklm_value); |
return false; |
} |