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

@@ -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){

View File

@@ -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, () -> {