getField should return null on exception

This commit is contained in:
fullwall 2019-05-21 19:26:33 +08:00
parent 156fbca6ce
commit 9fa1646ad6
1 changed files with 2 additions and 1 deletions

View File

@ -80,12 +80,13 @@ public class NMS {
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) {