From 0beaaa4603a37f3dd21ed3f3a7efc4f1d36bcc32 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 13 Nov 2021 23:27:57 +0200 Subject: [PATCH] Fixed exception when encountering unknown traits whilst loading from json --- .../unicopia/ability/magic/spell/trait/SpellTraits.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java index 13992080..c7633e4a 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/trait/SpellTraits.java @@ -201,7 +201,7 @@ public final class SpellTraits implements Iterable> { public static Stream> streamFromJson(JsonObject traits) { return traits.entrySet().stream().map(entry -> { Trait trait = Trait.REGISTRY.get(entry.getKey().toUpperCase()); - if (trait == null && !entry.getValue().isJsonPrimitive() && !entry.getValue().getAsJsonPrimitive().isNumber()) { + if (trait == null || !entry.getValue().isJsonPrimitive() && !entry.getValue().getAsJsonPrimitive().isNumber()) { return null; } return Map.entry(trait, entry.getValue().getAsJsonPrimitive().getAsFloat());