From eb4a76dcd0f5c9827a9cfaf86fdfe6d277b2e63b Mon Sep 17 00:00:00 2001 From: yairm210 Date: Thu, 23 Dec 2021 21:15:20 +0200 Subject: [PATCH] Resolved #5823 --- core/src/com/unciv/ui/saves/SaveGameScreen.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/ui/saves/SaveGameScreen.kt b/core/src/com/unciv/ui/saves/SaveGameScreen.kt index 128c531587..3b0d8c1f84 100644 --- a/core/src/com/unciv/ui/saves/SaveGameScreen.kt +++ b/core/src/com/unciv/ui/saves/SaveGameScreen.kt @@ -39,9 +39,13 @@ class SaveGameScreen(val gameInfo: GameInfo) : PickerScreen(disableScroll = true val copyJsonButton = "Copy to clipboard".toTextButton() copyJsonButton.onClick { - val json = Json().toJson(gameInfo) - val base64Gzip = Gzip.zip(json) - Gdx.app.clipboard.contents = base64Gzip + try { + val json = Json().toJson(gameInfo) + val base64Gzip = Gzip.zip(json) + Gdx.app.clipboard.contents = base64Gzip + } catch (OOM: OutOfMemoryError) { + // you don't get a special toast, this isn't nearly common enough, this is a total edge-case + } } newSave.add(copyJsonButton).row() if (GameSaver.canLoadFromCustomSaveLocation()) {