diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/LegacyLithoViewRule.kt b/litho-testing/src/main/java/com/facebook/litho/testing/LegacyLithoViewRule.kt index 7ffef11b52..7b55c03df7 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/LegacyLithoViewRule.kt +++ b/litho-testing/src/main/java/com/facebook/litho/testing/LegacyLithoViewRule.kt @@ -427,7 +427,7 @@ constructor( } private fun findViewWithPredicateOrNull(viewTree: ViewTree, predicate: Predicate): View? { - return viewTree.findChild(predicate)?.last() + return viewTree.findChild(predicate)?.lastOrNull() } /** diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/TestLithoView.kt b/litho-testing/src/main/java/com/facebook/litho/testing/TestLithoView.kt index 75559b8255..47f670a998 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/TestLithoView.kt +++ b/litho-testing/src/main/java/com/facebook/litho/testing/TestLithoView.kt @@ -394,7 +394,7 @@ internal constructor( } private fun findViewWithPredicateOrNull(viewTree: ViewTree, predicate: Predicate): View? { - return viewTree.findChild(predicate)?.last() + return viewTree.findChild(predicate)?.lastOrNull() } /** Returns the first [LazyCollection] from the ComponentTree, or null if not found. */