mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2025-02-11 19:50:30 +00:00
Default to empty if map is empty in serializer
This commit is contained in:
parent
d849041604
commit
80b11bfc6a
1 changed files with 11 additions and 2 deletions
|
@ -105,8 +105,17 @@ public class SerializerFlagWatcher implements JsonDeserializer<FlagWatcher>, Jso
|
||||||
if (opt instanceof ParameterizedType) {
|
if (opt instanceof ParameterizedType) {
|
||||||
Type val = ((ParameterizedType) opt).getActualTypeArguments()[0];
|
Type val = ((ParameterizedType) opt).getActualTypeArguments()[0];
|
||||||
|
|
||||||
entry.setValue(Optional.of(
|
Optional value;
|
||||||
gson.fromJson(gson.toJson(((LinkedTreeMap) entry.getValue()).get("value")), val)));
|
|
||||||
|
if (((LinkedTreeMap) entry.getValue()).isEmpty()) {
|
||||||
|
value = Optional.empty();
|
||||||
|
} else {
|
||||||
|
value = Optional
|
||||||
|
.of(gson.fromJson(gson.toJson(((LinkedTreeMap) entry.getValue()).get("value")),
|
||||||
|
val));
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.setValue(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue