localui: Avoid crash on NULL pointer.

This commit is contained in:
Detlef Riekenberg 2007-04-24 00:05:47 +02:00 committed by Alexandre Julliard
parent 7aa1b2e419
commit 009b8dd519
1 changed files with 2 additions and 2 deletions

View File

@ -50,11 +50,11 @@ static LPWSTR strdupWW(LPCWSTR pPrefix, LPCWSTR pSuffix)
LPWSTR ptr; LPWSTR ptr;
DWORD len; DWORD len;
len = lstrlenW(pPrefix) + lstrlenW(pSuffix) + 1; len = lstrlenW(pPrefix) + (pSuffix ? lstrlenW(pSuffix) : 0) + 1;
ptr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); ptr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (ptr) { if (ptr) {
lstrcpyW(ptr, pPrefix); lstrcpyW(ptr, pPrefix);
lstrcatW(ptr, pSuffix); if (pSuffix) lstrcatW(ptr, pSuffix);
} }
return ptr; return ptr;
} }