Commit 3b9e6c1cecdbf6a58fee9d585956bffb4614c15d

Ozkan Sezer 2022-02-04T19:50:20

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.

diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c
index d624575..e955648 100644
--- a/src/video/os2/SDL_os2video.c
+++ b/src/video/os2/SDL_os2video.c
@@ -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;
 }