src/video/SDL_clipboard.c
changeset 9349 7674af9a59c8
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
     1.1 --- a/src/video/SDL_clipboard.c	Sun Feb 15 11:33:39 2015 +0100
     1.2 +++ b/src/video/SDL_clipboard.c	Sun Feb 15 11:35:07 2015 +0100
     1.3 @@ -29,6 +29,10 @@
     1.4  {
     1.5      SDL_VideoDevice *_this = SDL_GetVideoDevice();
     1.6  
     1.7 +    if (!_this) {
     1.8 +        return SDL_SetError("Video subsystem must be initialized to set clipboard text");
     1.9 +    }
    1.10 +
    1.11      if (!text) {
    1.12          text = "";
    1.13      }
    1.14 @@ -46,6 +50,11 @@
    1.15  {
    1.16      SDL_VideoDevice *_this = SDL_GetVideoDevice();
    1.17  
    1.18 +    if (!_this) {
    1.19 +        SDL_SetError("Video subsystem must be initialized to get clipboard text");
    1.20 +        return SDL_strdup("");
    1.21 +    }
    1.22 +
    1.23      if (_this->GetClipboardText) {
    1.24          return _this->GetClipboardText(_this);
    1.25      } else {
    1.26 @@ -62,6 +71,11 @@
    1.27  {
    1.28      SDL_VideoDevice *_this = SDL_GetVideoDevice();
    1.29  
    1.30 +    if (!_this) {
    1.31 +        SDL_SetError("Video subsystem must be initialized to check clipboard text");
    1.32 +        return SDL_FALSE;
    1.33 +    }
    1.34 +
    1.35      if (_this->HasClipboardText) {
    1.36          return _this->HasClipboardText(_this);
    1.37      } else {