SDL: Allow a NULL size parameter to retrieve null terminated text

From 30a22d3fede258135416534560593f7333ee2ca9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 31 Dec 2024 12:52:16 -0800
Subject: [PATCH] Allow a NULL size parameter to retrieve null terminated text

---
 src/video/SDL_clipboard.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video/SDL_clipboard.c b/src/video/SDL_clipboard.c
index e669f0de5eea9..a0a65c666c302 100644
--- a/src/video/SDL_clipboard.c
+++ b/src/video/SDL_clipboard.c
@@ -174,6 +174,7 @@ void *SDL_GetInternalClipboardData(SDL_VideoDevice *_this, const char *mime_type
 void *SDL_GetClipboardData(const char *mime_type, size_t *size)
 {
     SDL_VideoDevice *_this = SDL_GetVideoDevice();
+    size_t unused;
 
     if (!_this) {
         SDL_UninitializedVideo();
@@ -185,8 +186,7 @@ void *SDL_GetClipboardData(const char *mime_type, size_t *size)
         return NULL;
     }
     if (!size) {
-        SDL_InvalidParamError("size");
-        return NULL;
+        size = &unused;
     }
 
     // Initialize size to empty, so implementations don't have to worry about it