serve: fixed that's server can't start on some wrong config settings

This commit is contained in:
Oleg Agafonov 2025-06-05 00:17:28 +04:00
parent 2bb26521c5
commit 17cefacea7
3 changed files with 5 additions and 7 deletions

View file

@ -51,7 +51,7 @@ public enum GameFactory {
} }
public void addGameType(String name, MatchType matchType, Class game) { public void addGameType(String name, MatchType matchType, Class game) {
if (game != null) { if (matchType != null && game != null) {
this.games.put(name, game); this.games.put(name, game);
this.gameTypes.put(name, matchType); this.gameTypes.put(name, matchType);
this.gameTypeViews.add(new GameTypeView(matchType)); this.gameTypeViews.add(new GameTypeView(matchType));

View file

@ -45,12 +45,10 @@ public enum PlayerFactory {
} }
public void addPlayerType(String name, Class playerType) { public void addPlayerType(String name, Class playerType) {
// will raise error and stop on unknown player and that's ok - it's require HumanPlayer anyway
PlayerType type = PlayerType.getByDescription(name); PlayerType type = PlayerType.getByDescription(name);
if (type != null) { if (playerType != null) {
if (playerType != null) { this.playerTypes.put(type, playerType);
this.playerTypes.put(type, playerType);
}
} }
} }
} }

View file

@ -93,7 +93,7 @@ public enum TournamentFactory {
public void addTournamentType(String name, TournamentType tournamentType, Class tournament) { public void addTournamentType(String name, TournamentType tournamentType, Class tournament) {
if (tournament != null) { if (tournamentType != null && tournament != null) {
this.tournaments.put(name, tournament); this.tournaments.put(name, tournament);
this.tournamentTypes.put(name, tournamentType); this.tournamentTypes.put(name, tournamentType);
this.tournamentTypeViews.add(new TournamentTypeView(tournamentType)); this.tournamentTypeViews.add(new TournamentTypeView(tournamentType));