Skip to content

Commit 437f10b

Browse files
committed
try catch check
1 parent aec56fa commit 437f10b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,12 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
116116
if (bFieldCheckNotProcess != null) {
117117
// startsWith "_check_"
118118
name = name.substring("_check_".length());
119-
Reflector on = Reflector.on(aClass).field(name);
120-
return on.getField();
119+
try {
120+
Reflector on = Reflector.on(aClass).field(name);
121+
return on.getField();
122+
} catch (Throwable ignored) {
123+
return null;
124+
}
121125
}
122126

123127
Class<?>[] paramClass = getParamClass(method);
@@ -127,8 +131,11 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
127131
if (bMethodCheckNotProcess != null) {
128132
// startsWith "_check_"
129133
name = name.substring("_check_".length());
130-
Reflector on = Reflector.on(aClass).method(name, paramClass);
131-
return on.getMethod();
134+
try {
135+
return Reflector.on(aClass).method(name, paramClass).getMethod();
136+
} catch (Throwable ignored) {
137+
return null;
138+
}
132139
}
133140

134141
// method

0 commit comments

Comments
 (0)