user: GetClipboardFormatNameA fix.

In the W->A translation make sure we have characters to translate
before doing the WideCharToMultiByte with -1.
This commit is contained in:
Aric Stewart 2005-12-14 10:49:54 +01:00 committed by Alexandre Julliard
parent 2302d2b470
commit c50fbab47f
1 changed files with 1 additions and 1 deletions

View File

@ -271,7 +271,7 @@ INT WINAPI GetClipboardFormatNameA(UINT wFormat, LPSTR retStr, INT maxlen)
ret = GetClipboardFormatNameW( wFormat, p, maxlen );
if (maxlen > 0 && !WideCharToMultiByte( CP_ACP, 0, p, -1, retStr, maxlen, 0, 0))
if (ret && maxlen > 0 && !WideCharToMultiByte( CP_ACP, 0, p, -1, retStr, maxlen, 0, 0))
retStr[maxlen-1] = 0;
HeapFree( GetProcessHeap(), 0, p );
return ret;