Windows: Return early if the clipboard data is not Unicode text

This commit is contained in:
Muhammad Rifqi Priyo Susanto 2024-01-05 03:24:50 +07:00 committed by GitHub
parent 54b82aad26
commit 91e4129615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -159,10 +159,11 @@ const c8* COSOperator::getTextFromClipboard() const
if (!OpenClipboard(NULL))
return 0;
wchar_t * buffer = 0;
HANDLE hData = GetClipboardData( CF_UNICODETEXT );
buffer = (wchar_t*) GlobalLock( hData );
if (hData == NULL) // Probably not in Unicode text format
return 0;
wchar_t * buffer = (wchar_t*) GlobalLock( hData );
core::wStringToUTF8(ClipboardBuf, buffer);