Update StarMainApplication_sdl.cpp

This commit is contained in:
Kae 2023-11-29 13:45:13 +11:00
parent b52d7405f2
commit 65cf738832

View File

@ -458,9 +458,15 @@ private:
: parent(parent) {} : parent(parent) {}
Maybe<String> getClipboard() override { Maybe<String> getClipboard() override {
if (SDL_HasClipboardText()) Maybe<String> string;
return String(SDL_GetClipboardText()); if (SDL_HasClipboardText()) {
return {}; auto text = SDL_GetClipboardText();
if (text && *text != NULL) {
string.emplace(text);
SDL_free(text);
}
}
return string;
} }
void setClipboard(String text) override { void setClipboard(String text) override {