🚑 Make trainer field fully nullable in PokemongCodec

pull/6/head
Alexis Drai 2 years ago
parent e1885b2a1f
commit 5321ca85f4

@ -128,8 +128,10 @@ public class PokemongCodec extends GenericCodec<Pokemong> {
.collect(Collectors.toList()); .collect(Collectors.toList());
pokemong.setEvoTrack(evoTrack); pokemong.setEvoTrack(evoTrack);
pokemong.setTrainer(document.getObjectId("trainer") ObjectId trainerId = document.getObjectId("trainer");
.toString()); if (trainerId != null) {
pokemong.setTrainer(trainerId.toString());
}
List<Type> types = document.getList("types", Document.class) List<Type> types = document.getList("types", Document.class)
.stream() .stream()

Loading…
Cancel
Save