From 753efe5f470700a0f1abb3c413c958f6503cf4ad Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 18 Sep 2019 22:28:16 +0300 Subject: [PATCH] Added error popup when failed to download map --- core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt | 6 ++++++ core/src/com/unciv/ui/worldscreen/optionstable/DropBox.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt index 3bd211c70d..90c84c4048 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt @@ -114,6 +114,12 @@ class MapDownloadTable(mapEditorScreen: MapEditorScreen):PopupTable(mapEditorScr val downloadMapButton = TextButton(downloadableMap.name, CameraStageBaseScreen.skin) downloadMapButton.onClick { val mapJsonGzipped = DropBox().downloadFile(downloadableMap.path_display) + if(mapJsonGzipped==""){ + val couldNotDownloadMapPopup = PopupTable(screen) + couldNotDownloadMapPopup.addGoodSizedLabel("Could not download map!").row() + couldNotDownloadMapPopup.addCloseButton() + return@onClick + } val decodedMapJson = Gzip.unzip(mapJsonGzipped) val mapObject = MapSaver().mapFromJson(decodedMapJson) MapSaver().saveMap(downloadableMap.name, mapObject) diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/DropBox.kt b/core/src/com/unciv/ui/worldscreen/optionstable/DropBox.kt index ce587fd862..aa8a3006eb 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/DropBox.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/DropBox.kt @@ -41,7 +41,7 @@ class DropBox(){ println(ex.message) val reader = BufferedReader(InputStreamReader(errorStream)) println(reader.readText()) - return "Error!" + return "" } } }