Fixed launcher behaving unexpectedly if game.set was malformed

This commit is contained in:
François Autin 2021-06-24 14:51:06 +02:00
parent 8c146b324b
commit 6476cb6249
2 changed files with 4 additions and 5 deletions

View File

@ -134,10 +134,10 @@ public class Launcher extends Application {
b1.setItems(availablechar);
b2.setItems(availablechar);
// Setting default ChoiceBoxes values to the ones already in the config file
if(setter.getChar1().equals("blue")) {
if(setter.getChar1().equals("blue") || setter.getChar1().equals("default")) {
b1.setValue("Blue");
}
if(setter.getChar2().equals("blue")) {
if(setter.getChar2().equals("blue") || setter.getChar2().equals("default")) {
b2.setValue("Blue");
}
@ -168,9 +168,9 @@ public class Launcher extends Application {
setter.setSettings();
match.main(null);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
System.out.println("Fill all boxes to launch the game");
}
}
/**

View File

@ -94,7 +94,6 @@ public class Settings {
e.printStackTrace();
System.exit(1);
} catch (ParseException e) {
System.out.println("Invalid config file");
rounds = 3;
p1 = "default";
p2 = "default";