From 3bb2375d3b42288cade1f4fc3851100bfb9b7422 Mon Sep 17 00:00:00 2001 From: lisonge Date: Wed, 11 Oct 2023 17:19:56 +0800 Subject: [PATCH] fix: getChild array index bound error --- app/src/main/java/li/songe/gkd/service/AbExt.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/li/songe/gkd/service/AbExt.kt b/app/src/main/java/li/songe/gkd/service/AbExt.kt index 0d65b00..d21c813 100644 --- a/app/src/main/java/li/songe/gkd/service/AbExt.kt +++ b/app/src/main/java/li/songe/gkd/service/AbExt.kt @@ -140,10 +140,11 @@ private val getAttr: (AccessibilityNodeInfo, String) -> Any? = { node, name -> } } -val abTransform = Transform(getAttr = getAttr, +val abTransform = Transform( + getAttr = getAttr, getName = { node -> node.className }, getChildren = getChildren, - getChild = { node, index -> node.getChild(index) }, + getChild = { node, index -> if (index in 0.. node.parent }, getDescendants = { node -> sequence {