mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
Fixed crash if a clipboard event was sent with video uninitialized
This can happen if you're using SDL on Android without using the video subsystem.
This commit is contained in:
@@ -42,6 +42,10 @@ void SDL_CancelClipboardData(Uint32 sequence)
|
|||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
|
|
||||||
|
if (!_this) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (sequence && sequence != _this->clipboard_sequence) {
|
if (sequence && sequence != _this->clipboard_sequence) {
|
||||||
// This clipboard data was already canceled
|
// This clipboard data was already canceled
|
||||||
return;
|
return;
|
||||||
@@ -62,6 +66,10 @@ bool SDL_SaveClipboardMimeTypes(const char **mime_types, size_t num_mime_types)
|
|||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
|
|
||||||
|
if (!_this) {
|
||||||
|
return SDL_UninitializedVideo();
|
||||||
|
}
|
||||||
|
|
||||||
SDL_FreeClipboardMimeTypes(_this);
|
SDL_FreeClipboardMimeTypes(_this);
|
||||||
|
|
||||||
if (mime_types && num_mime_types > 0) {
|
if (mime_types && num_mime_types > 0) {
|
||||||
@@ -234,13 +242,11 @@ bool SDL_HasClipboardData(const char *mime_type)
|
|||||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
|
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
SDL_UninitializedVideo();
|
return SDL_UninitializedVideo();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mime_type) {
|
if (!mime_type) {
|
||||||
SDL_InvalidParamError("mime_type");
|
return SDL_InvalidParamError("mime_type");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->HasClipboardData) {
|
if (_this->HasClipboardData) {
|
||||||
|
Reference in New Issue
Block a user