aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <[email protected]>2012-03-03 13:44:42 -0500
committerLuke Dashjr <[email protected]>2012-03-03 13:45:44 -0500
commit4fc8c042a2f80ce0a1a277a2dcc1240c015ed400 (patch)
tree54dd76dd9b29a8bba92a483b6bab8d732d643e87 /src/util.cpp
parentMerge remote branch 'sipa/nooverwritetx_v0.4.0' into 0.4.x (diff)
downloaddiscoin-4fc8c042a2f80ce0a1a277a2dcc1240c015ed400.tar.xz
discoin-4fc8c042a2f80ce0a1a277a2dcc1240c015ed400.zip
Bugfix: Check return value of SHGetSpecialFolderPath in MyGetSpecialFolderPath
Upstream commit: 21ae37d (partial)
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 85ca02f0a..e2e104cc8 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)
{