Fix drawn players

This commit is contained in:
Michel ten Voorde
2024-10-25 14:32:05 +02:00
parent 8af99e29ee
commit f91c50af7b
4 changed files with 34 additions and 274 deletions

View File

@@ -65,7 +65,12 @@ public class TournamentController {
@PostMapping("/tournaments")
public ResponseEntity<TournamentDto> createTournament(@RequestBody TournamentDto tournamentDto) {
var tournament = tournamentMapper.toEntity(tournamentDto);
Tournament tournament;
try {
tournament = tournamentMapper.toEntity(tournamentDto);
} catch (NullPointerException e) {
return ResponseEntity.badRequest().build();
}
return ResponseEntity.ok(tournamentMapper.toDto(tournamentService.saveTournament(tournament)));
}