Fix trailer button produces crash if no trailers are available
This commit is contained in:
parent
5891e0f382
commit
70d0d62318
1 changed files with 2 additions and 1 deletions
|
@ -75,7 +75,7 @@ class MediaInfoFragment : Fragment() {
|
|||
} else {
|
||||
binding.originalTitle.visibility = View.GONE
|
||||
}
|
||||
if (item.trailerCount != null && item.trailerCount!! < 1) {
|
||||
if (item.remoteTrailers.isNullOrEmpty()) {
|
||||
binding.trailerButton.visibility = View.GONE
|
||||
}
|
||||
binding.communityRating.visibility = when (item.communityRating != null) {
|
||||
|
@ -147,6 +147,7 @@ class MediaInfoFragment : Fragment() {
|
|||
}
|
||||
|
||||
binding.trailerButton.setOnClickListener {
|
||||
if (viewModel.item.value?.remoteTrailers.isNullOrEmpty()) return@setOnClickListener
|
||||
val intent = Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse(viewModel.item.value?.remoteTrailers?.get(0)?.url)
|
||||
|
|
Loading…
Reference in a new issue