diff --git a/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java b/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java index 9260a0f..e7752e5 100644 --- a/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java +++ b/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java @@ -116,8 +116,12 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl if (bFieldCheckNotProcess != null) { // startsWith "_check_" name = name.substring("_check_".length()); - Reflector on = Reflector.on(aClass).field(name); - return on.getField(); + try { + Reflector on = Reflector.on(aClass).field(name); + return on.getField(); + } catch (Throwable ignored) { + return null; + } } Class[] paramClass = getParamClass(method); @@ -127,8 +131,11 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl if (bMethodCheckNotProcess != null) { // startsWith "_check_" name = name.substring("_check_".length()); - Reflector on = Reflector.on(aClass).method(name, paramClass); - return on.getMethod(); + try { + return Reflector.on(aClass).method(name, paramClass).getMethod(); + } catch (Throwable ignored) { + return null; + } } // method