From 65cf738832bf9e1e045ebff87df43a292d501ac2 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:45:13 +1100 Subject: [PATCH] Update StarMainApplication_sdl.cpp --- source/application/StarMainApplication_sdl.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 {