Skip to content

Commit cce8a6a

Browse files
committed
[ServiceInfo]
* fix crash when current audio track is -1
1 parent d513302 commit cce8a6a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/python/Components/Converter/ServiceInfo.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,14 @@ def getBoolean(self):
135135
def isMultichannelAudio(invert):
136136
audio = service.audioTracks()
137137
if audio and audio.getNumberOfTracks():
138-
description = audio.getTrackInfo(audio.getCurrentTrack()).getDescription() # Some audio descriptions have 'audio' as additional value (e.g. "AC-3 audio").
139-
result = bool(description and description.split()[0] in ("AC3", "AC3+", "DTS", "DTS-HD", "AC4", "LPCM", "Dolby", "HE-AAC", "AAC+", "WMA"))
140-
if invert:
141-
result = not result
138+
currentTrack = audio.getCurrentTrack()
139+
if currentTrack > -1:
140+
description = audio.getTrackInfo(currentTrack).getDescription() # Some audio descriptions have 'audio' as additional value (e.g. "AC-3 audio").
141+
result = bool(description and description.split()[0] in ("AC3", "AC3+", "DTS", "DTS-HD", "AC4", "LPCM", "Dolby", "HE-AAC", "AAC+", "WMA"))
142+
if invert:
143+
result = not result
144+
else:
145+
result = False
142146
else:
143147
result = False
144148
return result

0 commit comments

Comments
 (0)