Skip to content

Commit

Permalink
Dismiss the Subfilter sheet if any required argument is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Horta committed Feb 8, 2024
1 parent 51ae6a7 commit ceb4c52
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,14 @@ class SubfilterBottomSheetFragment : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val subfilterVmKey = requireArguments().getString(SUBFILTER_VIEW_MODEL_KEY)!!
val bottomSheetTitle = requireArguments().getCharSequence(SUBFILTER_TITLE_KEY)!!
val category = requireArguments().getSerializableCompat<SubfilterCategory>(SUBFILTER_CATEGORY_KEY)!!
val subfilterVmKey = requireArguments().getString(SUBFILTER_VIEW_MODEL_KEY)
val bottomSheetTitle = requireArguments().getCharSequence(SUBFILTER_TITLE_KEY)
val category = requireArguments().getSerializableCompat<SubfilterCategory>(SUBFILTER_CATEGORY_KEY)

if (subfilterVmKey == null || category == null || bottomSheetTitle == null) {
dismiss()
return
}

viewModel = ViewModelProvider(
parentFragment as ViewModelStoreOwner,
Expand Down

0 comments on commit ceb4c52

Please sign in to comment.