SDL_os2video.c: fixed HasClipboardText() semantics.

Empty string in clipboard is expected to give FALSE by SDL_HasClipboardText.
Noticed in a commit by josch1710 in bitwiseworks' os/2 fork.
This commit is contained in:
Ozkan Sezer 2022-02-04 19:50:20 +03:00
parent 86b7a0642f
commit 3b9e6c1cec
1 changed files with 3 additions and 4 deletions

View File

@ -1401,18 +1401,17 @@ static char *OS2_GetClipboardText(_THIS)
static SDL_bool OS2_HasClipboardText(_THIS)
{
SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata;
SDL_bool fClipboard;
PSZ pszClipboard;
if (!WinOpenClipbrd(pVData->hab)) {
debug_os2("WinOpenClipbrd() failed");
return SDL_FALSE;
}
fClipboard = ((PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT) != NULL)?
SDL_TRUE : SDL_FALSE;
pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT);
WinCloseClipbrd(pVData->hab);
return fClipboard;
return (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE;
}