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) {}
Maybe<String> getClipboard() override {
if (SDL_HasClipboardText())
return String(SDL_GetClipboardText());
return {};
Maybe<String> 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 {