Commit 7aa56d24 authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

regedit: Don't try to convert NULL pointers.

parent df84eb51
...@@ -70,13 +70,17 @@ if (!(p)) \ ...@@ -70,13 +70,17 @@ if (!(p)) \
*/ */
WCHAR* GetWideString(const char* strA) WCHAR* GetWideString(const char* strA)
{ {
WCHAR* strW = NULL; if(strA)
int len = MultiByteToWideChar(CP_ACP, 0, strA, -1, NULL, 0); {
WCHAR* strW = NULL;
int len = MultiByteToWideChar(CP_ACP, 0, strA, -1, NULL, 0);
strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
CHECK_ENOUGH_MEMORY(strW); CHECK_ENOUGH_MEMORY(strW);
MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len); MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len);
return strW; return strW;
}
return NULL;
} }
/****************************************************************************** /******************************************************************************
...@@ -85,13 +89,17 @@ WCHAR* GetWideString(const char* strA) ...@@ -85,13 +89,17 @@ WCHAR* GetWideString(const char* strA)
*/ */
char* GetMultiByteString(const WCHAR* strW) char* GetMultiByteString(const WCHAR* strW)
{ {
char* strA = NULL; if(strW)
int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL); {
char* strA = NULL;
int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL);
strA = HeapAlloc(GetProcessHeap(), 0, len); strA = HeapAlloc(GetProcessHeap(), 0, len);
CHECK_ENOUGH_MEMORY(strA); CHECK_ENOUGH_MEMORY(strA);
WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, NULL, NULL);
return strA; return strA;
}
return NULL;
} }
/****************************************************************************** /******************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment