File tree Expand file tree Collapse file tree
library/src/main/java/me/proxer/library Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,7 +77,9 @@ public Set<T> fromJson(final JsonReader reader) throws IOException {
7777
7878 for (final String part : parts ) {
7979 for (final Field field : enumType .getFields ()) {
80- if (field .getAnnotation (Json .class ).name ().equals (part )) {
80+ Json annotation = field .getAnnotation (Json .class );
81+
82+ if (annotation != null && annotation .name ().equalsIgnoreCase (part )) {
8183 result .add (Enum .valueOf (enumType , field .getName ()));
8284
8385 break ;
Original file line number Diff line number Diff line change @@ -40,7 +40,9 @@ public String getApiEnumName(final Enum<?> it) {
4040 @ Nullable
4141 public <T extends Enum <T >> T toApiEnum (final Class <T > type , final String value ) {
4242 for (final Field field : type .getFields ()) {
43- if (field .getAnnotation (Json .class ).name ().equalsIgnoreCase (value )) {
43+ Json annotation = field .getAnnotation (Json .class );
44+
45+ if (annotation != null && annotation .name ().equalsIgnoreCase (value )) {
4446 return Enum .valueOf (type , field .getName ());
4547 }
4648 }
You can’t perform that action at this time.
0 commit comments