From 6b9475275fbaf2df5676aa7f92a7fc5fc72b1165 Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Wed, 7 Feb 2024 14:55:24 -0300 Subject: [PATCH] Fix UninitializedPropertyAccessException in ReaderFragment onSaveInstanceState --- .../java/org/wordpress/android/ui/reader/ReaderFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 28397a28fb70..29fafc842e2f 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 @@ -168,7 +168,9 @@ class ReaderFragment : Fragment(R.layout.reader_fragment_layout), ScrollableView override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - viewModel.onSaveInstanceState(outState) + if (::viewModel.isInitialized) { + viewModel.onSaveInstanceState(outState) + } } private fun updateUiState(uiState: ReaderViewModel.ReaderUiState) {