fix crash in ViewThreadFragment (#3250)

This commit is contained in:
Konrad Pozniak 2023-02-03 19:21:21 +01:00 committed by GitHub
parent fac62a638e
commit 07a4e97e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ import android.widget.LinearLayout
import androidx.annotation.CheckResult
import androidx.fragment.app.commit
import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.DividerItemDecoration
@ -211,7 +212,7 @@ class ViewThreadFragment : SFragment(), OnRefreshListener, StatusActionListener,
threadProgressBar.cancel()
adapter.submitList(uiState.statusViewData) {
if (viewModel.isInitialLoad) {
if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED) && viewModel.isInitialLoad) {
viewModel.isInitialLoad = false
// Ensure the top of the status is visible