Skip to content

Commit

Permalink
SDL_os2video.c: fixed HasClipboardText() semantics.
Browse files Browse the repository at this point in the history
Empty string in clipboard is expected to give FALSE by SDL_HasClipboardText.
Noticed in a commit by josch1710 in bitwiseworks' os/2 fork.
  • Loading branch information
sezero committed Feb 4, 2022
1 parent 86b7a06 commit 3b9e6c1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/video/os2/SDL_os2video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down

0 comments on commit 3b9e6c1

Please sign in to comment.