Fixed crash when trying to open non-existent map

This commit is contained in:
Anuken
2018-11-03 09:39:59 -04:00
parent f2c7a26ce0
commit 76a6a0cf75
3 changed files with 9 additions and 6 deletions
+1
View File
@@ -268,6 +268,7 @@ text.error.invalidaddress = Invalid address.
text.error.timedout = Timed out!\nMake sure the host has port forwarding set up, and that the address is correct!
text.error.mismatch = Packet error:\npossible client/server version mismatch.\nMake sure you and the host have the latest version of Mindustry!
text.error.alreadyconnected = Already connected.
text.error.mapnotfound = Map file not found!
text.error.any = Unkown network error.
text.settings.language = Language
@@ -177,8 +177,6 @@ public class JoinDialog extends FloatingDialog{
t.add("[lightgray]" + Bundles.format("text.save.map", host.mapname) + " / " + Bundles.format("text.save.wave", host.wave)).left();
}).expand().left().bottom().padLeft(12f).padBottom(8);
//server.content.add(versionString).top().expandY().top().expandX();
}, e -> {
server.content.clear();
server.content.add("$text.host.invalid");
@@ -323,7 +321,6 @@ public class JoinDialog extends FloatingDialog{
public String ip;
public int port;
transient Host host;
transient Table content;
void setIP(String ip){
@@ -147,9 +147,14 @@ public class MapsDialog extends FloatingDialog{
table.row();
table.addImageTextButton("$text.editor.openin", "icon-load-map", "clear", 16 * 2, () -> {
Vars.ui.editor.beginEditMap(map.stream.get());
dialog.hide();
hide();
try{
Vars.ui.editor.beginEditMap(map.stream.get());
dialog.hide();
hide();
}catch(Exception e){
e.printStackTrace();
ui.showError("$text.error.mapnotfound");
}
}).fillX().height(50f).marginLeft(6);
table.addImageTextButton("$text.delete", "icon-trash-16", "clear", 16 * 2, () -> {