Skip to content
Snippets Groups Projects
Commit f735362f authored by Ernests Malnacs's avatar Ernests Malnacs
Browse files

Fixed a null check for the sortOrder parameter

parent 42c6e154
No related branches found
No related tags found
2 merge requests!203Issue #18, #19 resolved,!184Issue #11 GET handler for pokemon on /api/pokemon
This commit is part of merge request !203. Comments created here will be created in the context of that merge request.
......@@ -17,7 +17,7 @@ public class PokemonRoute {
public List<Pokemon> getPokemon(@QueryParam("sortBy") String sortOrder) {
Integer pageSize = Integer.MAX_VALUE;
List<Pokemon> pokemons = PokemonDao.INSTANCE.getPokemon(pageSize, 1);
if (sortOrder.equals("name")) {
if (sortOrder != null && sortOrder.equals("name")) {
pokemons.sort(Comparator.comparing(pok -> pok.name));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment