aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-03-03 13:44:42 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2012-03-03 13:45:44 -0500
commit4fc8c042a2f80ce0a1a277a2dcc1240c015ed400 (patch)
tree54dd76dd9b29a8bba92a483b6bab8d732d643e87
parente9865a41d669db0f9245d4494e1620e943ecddf8 (diff)
downloadbitcoin-4fc8c042a2f80ce0a1a277a2dcc1240c015ed400.tar.xz
Bugfix: Check return value of SHGetSpecialFolderPath in MyGetSpecialFolderPath
Upstream commit: 21ae37d (partial)
-rw-r--r--src/util.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 85ca02f0aa..e2e104cc88 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -643,13 +643,17 @@ string MyGetSpecialFolderPath(int nFolder, bool fCreate)
{
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
+ bool fSuccess = false;
if (pSHGetSpecialFolderPath)
+ fSuccess =
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
FreeModule(hShell32);
+ if (fSuccess)
+ return pszPath;
}
// Backup option
- if (pszPath[0] == '\0')
+ pszPath[0] = '\0';
{
if (nFolder == CSIDL_STARTUP)
{