🚑 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());
pokemong.setEvoTrack(evoTrack);
pokemong.setTrainer(document.getObjectId("trainer")
.toString());
ObjectId trainerId = document.getObjectId("trainer");
if (trainerId != null) {
pokemong.setTrainer(trainerId.toString());
}
List<Type> types = document.getList("types", Document.class)
.stream()

Loading…
Cancel
Save