diff --git a/source/application/StarMainApplication_sdl.cpp b/source/application/StarMainApplication_sdl.cpp index d9a0bd2..61a2fa2 100644 --- a/source/application/StarMainApplication_sdl.cpp +++ b/source/application/StarMainApplication_sdl.cpp @@ -458,9 +458,15 @@ private: : parent(parent) {} Maybe getClipboard() override { - if (SDL_HasClipboardText()) - return String(SDL_GetClipboardText()); - return {}; + Maybe string; + if (SDL_HasClipboardText()) { + auto text = SDL_GetClipboardText(); + if (text && *text != NULL) { + string.emplace(text); + SDL_free(text); + } + } + return string; } void setClipboard(String text) override {