From 07a4e97e9b250db12dcb7272d535aec97ac83323 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 3 Feb 2023 19:21:21 +0100 Subject: [PATCH] fix crash in ViewThreadFragment (#3250) --- .../tusky/components/viewthread/ViewThreadFragment.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt index 1493c294..cb361f5d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt @@ -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