Skip to content

Commit

Permalink
fix NEP when binding is null and onDestroyView is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Jan 10, 2022
1 parent f8baa80 commit 0197953
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class DialogFragmentViewBindingDelegate<T : ViewBinding, DF> private cons

var onDestroyViewActual = onDestroyView
listeners += {
onDestroyViewActual?.invoke(binding!!)
binding?.let { onDestroyViewActual?.invoke(it) }
onDestroyViewActual = null
binding = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class FragmentViewBindingDelegate<T : ViewBinding> private constructor(
override fun onDestroy(owner: LifecycleOwner) {
viewLifecycleOwner.lifecycle.removeObserver(this)

onDestroyViewActual?.invoke(binding!!)
binding?.let { onDestroyViewActual?.invoke(it) }
onDestroyViewActual = null
binding = null

Expand Down

0 comments on commit 0197953

Please sign in to comment.