Skip to content

Commit

Permalink
Fix SelectQualityAction crashing when opening menu
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Aug 6, 2024
1 parent f6c5368 commit 044ce67
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.jellyfin.androidtv.preference.UserPreferences
import org.jellyfin.androidtv.ui.playback.PlaybackController
import org.jellyfin.androidtv.ui.playback.VideoQualityController
import org.jellyfin.androidtv.ui.playback.overlay.CustomPlaybackTransportControlGlue
import org.jellyfin.androidtv.ui.playback.overlay.LeanbackOverlayFragment
import org.jellyfin.androidtv.ui.playback.overlay.VideoPlayerAdapter

class SelectQualityAction(
Expand Down Expand Up @@ -39,8 +38,11 @@ class SelectQualityAction(
}

menu.setGroupCheckable(0, true, true)
menu.getItem(qualityProfiles.keys.indexOf(qualityController.currentQuality))?.let { item ->
item.isChecked = true
val currentQualityIndex = qualityProfiles.keys.indexOf(qualityController.currentQuality)
if (currentQualityIndex != -1) {
menu.getItem(currentQualityIndex)?.let { item ->
item.isChecked = true
}
}

setOnDismissListener { videoPlayerAdapter.leanbackOverlayFragment.setFading(true) }
Expand Down

0 comments on commit 044ce67

Please sign in to comment.