From 19f6695ba8f25fcd8223eec3bf350ff67ae5399d Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Wed, 2 Jun 2021 16:29:48 +0200 Subject: [PATCH] feat: added exception if a deserialized character is non-existent --- .../json/ingame/deserialize/EntityDeserializer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/EntityDeserializer.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/EntityDeserializer.java index 1dbcb5e..9996394 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/EntityDeserializer.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/EntityDeserializer.java @@ -6,8 +6,8 @@ import com.fasterxml.jackson.databind.*; import uulm.teamname.marvelous.gamelibrary.IntVector2; import uulm.teamname.marvelous.gamelibrary.entities.*; import uulm.teamname.marvelous.gamelibrary.entities.Character; -import uulm.teamname.marvelous.gamelibrary.json.config.CharacterConfig; -import uulm.teamname.marvelous.gamelibrary.json.config.CharacterProperties; +import uulm.teamname.marvelous.gamelibrary.config.CharacterConfig; +import uulm.teamname.marvelous.gamelibrary.config.CharacterProperties; import uulm.teamname.marvelous.gamelibrary.json.ingame.SerializedEntityType; import java.io.IOException; @@ -37,6 +37,8 @@ public class EntityDeserializer extends JsonDeserializer { CharacterProperties properties = config.getMap().get(characterName); + if (properties == null) throw new IOException("Non-existent Character in Event"); + result = new Character( id, codec.treeToValue(node.get("position"), IntVector2.class),