From c6b8452508fc3cf75c214ff85f0f5800ebfe92eb Mon Sep 17 00:00:00 2001 From: Aditi Bhatia Date: Fri, 7 Jun 2024 17:40:03 -0700 Subject: [PATCH] Initialize viewmodel if not --- .../java/org/wordpress/android/ui/reader/ReaderFragment.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderFragment.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderFragment.kt index ea9bf586f22a..033a3b56f768 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderFragment.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderFragment.kt @@ -396,9 +396,10 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), ScrollableView } fun requestBookmarkTab() { - if (::viewModel.isInitialized) { - viewModel.bookmarkTabRequested() + if (!::viewModel.isInitialized) { + viewModel = ViewModelProvider(this@ReaderFragment, viewModelFactory)[ReaderViewModel::class.java] } + viewModel.bookmarkTabRequested() } private fun showReaderInterests() {