Call RegCloseKey only if handle is valid.

This commit is contained in:
Mounir IDRASSI 2014-09-24 18:31:52 +02:00
parent b80ee2b7b9
commit 411e8599f3

View File

@ -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;
}