Fix drawn players
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user