VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Registry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Registry.c')
-rw-r--r--src/Common/Registry.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Common/Registry.c b/src/Common/Registry.c
index a68e5f18..0b17dc51 100644
--- a/src/Common/Registry.c
+++ b/src/Common/Registry.c
@@ -114,7 +114,8 @@ char *ReadRegistryString (char *subKey, char *name, char *defaultValue, char *st
if (RegQueryValueEx (hkey, name, 0, 0, (LPBYTE) value, &size) == ERROR_SUCCESS)
StringCbCopyA (str, maxLen,value);
- RegCloseKey (hkey);
+ if (hkey)
+ RegCloseKey (hkey);
return str;
}