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

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.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.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.alreadyconnected = Already connected.
text.error.mapnotfound = Map file not found!
text.error.any = Unkown network error. text.error.any = Unkown network error.
text.settings.language = Language text.settings.language = Language

View File

@@ -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(); 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); }).expand().left().bottom().padLeft(12f).padBottom(8);
//server.content.add(versionString).top().expandY().top().expandX();
}, e -> { }, e -> {
server.content.clear(); server.content.clear();
server.content.add("$text.host.invalid"); server.content.add("$text.host.invalid");
@@ -323,7 +321,6 @@ public class JoinDialog extends FloatingDialog{
public String ip; public String ip;
public int port; public int port;
transient Host host;
transient Table content; transient Table content;
void setIP(String ip){ void setIP(String ip){

View File

@@ -147,9 +147,14 @@ public class MapsDialog extends FloatingDialog{
table.row(); table.row();
table.addImageTextButton("$text.editor.openin", "icon-load-map", "clear", 16 * 2, () -> { table.addImageTextButton("$text.editor.openin", "icon-load-map", "clear", 16 * 2, () -> {
Vars.ui.editor.beginEditMap(map.stream.get()); try{
dialog.hide(); Vars.ui.editor.beginEditMap(map.stream.get());
hide(); dialog.hide();
hide();
}catch(Exception e){
e.printStackTrace();
ui.showError("$text.error.mapnotfound");
}
}).fillX().height(50f).marginLeft(6); }).fillX().height(50f).marginLeft(6);
table.addImageTextButton("$text.delete", "icon-trash-16", "clear", 16 * 2, () -> { table.addImageTextButton("$text.delete", "icon-trash-16", "clear", 16 * 2, () -> {