Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't crash when viewing a thread and active account data is null #1259

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ class ViewThreadFragment :
private lateinit var adapter: ThreadAdapter
private lateinit var thisThreadsStatusId: String

private var alwaysShowSensitiveMedia = false
private var alwaysOpenSpoiler = false

override var pachliAccountId by Delegates.notNull<Long>()

/**
Expand All @@ -95,8 +92,7 @@ class ViewThreadFragment :
thisThreadsStatusId = requireArguments().getString(ARG_ID)!!

lifecycleScope.launch {
val statusDisplayOptions = viewModel.statusDisplayOptions.value
adapter = ThreadAdapter(statusDisplayOptions, this@ViewThreadFragment)
adapter = ThreadAdapter(viewModel.statusDisplayOptions.value, this@ViewThreadFragment)
}
}

Expand Down Expand Up @@ -128,8 +124,6 @@ class ViewThreadFragment :
MaterialDividerItemDecoration(requireContext(), MaterialDividerItemDecoration.VERTICAL),
)
binding.recyclerView.addItemDecoration(ConversationLineItemDecoration(requireContext()))
alwaysShowSensitiveMedia = accountManager.activeAccount!!.alwaysShowSensitiveMedia
alwaysOpenSpoiler = accountManager.activeAccount!!.alwaysOpenSpoiler

binding.recyclerView.adapter = adapter

Expand Down Expand Up @@ -303,7 +297,7 @@ class ViewThreadFragment :
super.viewMedia(
viewData.username,
attachmentIndex,
list(viewData.actionable, alwaysShowSensitiveMedia),
list(viewData.actionable, viewModel.statusDisplayOptions.value.showSensitiveMedia),
view,
)
}
Expand Down