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

This commit is contained in:
Niels van Velzen authored and Niels van Velzen committed 2024-08-12 08:30:40 +02:00
1 parent 6111cbec5a
commit 9577e11e41
1 file changed
+2 -2
@@ -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 }