Skip to content

Commit

Permalink
Fix clickableParent, findParentOrNull should not evaluate itself
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rken committed Dec 15, 2024
1 parent ac26cf4 commit bcceb37
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ fun AccessibilityNodeInfo.findParentOrNull(
maxNesting: Int = 3,
predicate: (AccessibilityNodeInfo) -> Boolean
): AccessibilityNodeInfo? {
var target = this
var target = this.parent ?: return null
for (i in 1..maxNesting) {
if (predicate(target)) return target
if (target.parent != null) target = target.parent
target = target.parent ?: break
}
return null
}
Expand Down

0 comments on commit bcceb37

Please sign in to comment.