prevent crash when language is invalid

This commit is contained in:
Charles Ewert 2023-09-04 13:12:38 -04:00
parent f359a7c3bf
commit 94f284567a

View File

@ -405,9 +405,11 @@ function FindPreferredAudioStream(streams as dynamic) as integer
if preferredLanguage <> invalid
for i = 0 to streams.Count() - 1
if LCase(streams[i].Type) = "audio" and LCase(streams[i].Language) = LCase(preferredLanguage)
if LCase(streams[i].Type) = "audio"
if streams[i].Language <> invalid and LCase(streams[i].Language) = LCase(preferredLanguage)
return i
end if
end if
end for
end if