Skip to content

Commit

Permalink
getField should return null on exception
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed May 21, 2019
1 parent 156fbca commit 9fa1646
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main/src/main/java/net/citizensnpcs/util/NMS.java
Expand Up @@ -80,12 +80,13 @@ public static Field getField(Class<?> clazz, String field, boolean log) {
try {
f = clazz.getDeclaredField(field);
f.setAccessible(true);
return f;
} catch (Exception e) {
if (log) {
Messaging.logTr(Messages.ERROR_GETTING_FIELD, field, e.getLocalizedMessage());
}
return null;
}
return f;
}

public static MethodHandle getFinalSetter(Class<?> clazz, String field) {
Expand Down

0 comments on commit 9fa1646

Please sign in to comment.