From 537a6acb227d03b588df1cd15e74c3b360460e81 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Wed, 7 Sep 2022 23:53:49 +0800 Subject: [PATCH] Fix bug when superclass is null hasExtends throw NullPointerException in ReflectionFactory --- .../highcapable/yukihookapi/hook/factory/ReflectionFactory.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt index 3380cdf0..7022ea04 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt @@ -69,7 +69,7 @@ enum class MembersType { * 当前 [Class] 是否有继承关系 - 父类是 [Any] 将被认为没有继承关系 * @return [Boolean] */ -val Class<*>.hasExtends get() = superclass.name != "java.lang.Object" +val Class<*>.hasExtends get() = superclass != null && superclass?.name != "java.lang.Object" /** * 通过字符串类名转换为 [loader] 中的实体类