Skip to content

Commit fbaed53

Browse files
authored
Merge pull request #3 from Telefonica/fix_loop
Avoid infinite loop on coordinator parent identification
2 parents dacbabf + 0e7376c commit fbaed53

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nestedscrollwebview/src/main/java/com/telefonica/nestedscrollwebview/helper/CoordinatorLayoutChildHelper.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ class CoordinatorLayoutChildHelper {
1717
coordinatorChildView = null
1818
coordinatorParentView = null
1919

20-
var childView: View = view
21-
while (childView.parent is View && coordinatorParentView == null) {
20+
var childView: View? = view
21+
while (childView?.parent is View && coordinatorParentView == null) {
2222
when(val viewParent: ViewParent = childView.parent) {
2323
is CoordinatorLayout -> {
2424
coordinatorParentView = viewParent
2525
coordinatorChildView = childView
2626
}
2727
is View ->
2828
childView = viewParent
29+
else ->
30+
childView = null
2931
}
3032
}
3133
}

0 commit comments

Comments
 (0)