Skip to content

Commit

Permalink
Allow a NULL size parameter to retrieve null terminated text
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 31, 2024
1 parent fea769e commit ab00ff2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/SDL_clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down

0 comments on commit ab00ff2

Please sign in to comment.