Fix crash when item doesn't have a default audio/subtitle stream

(cherry picked from commit 9577e11e41)
This commit is contained in:
Niels van Velzen 2024-08-11 16:31:30 +02:00
parent 7d84011d81
commit 389c48a1fd

View File

@ -139,8 +139,8 @@ fun InfoRowSeasonEpisode(item: BaseItemDto) {
private fun List<MediaStream>.getDefault(type: MediaStreamType, defaultIndex: Int? = null): MediaStream? {
if (defaultIndex != null) {
val byIndex = get(defaultIndex)
if (byIndex.type == type) return byIndex
val byIndex = getOrNull(defaultIndex)
if (byIndex?.type == type) return byIndex
}
return firstOrNull { it.type == type }