fix NPE when captionsArray is null

changed tabs to spaces
This commit is contained in:
forsythe 2018-02-28 22:46:11 +08:00
parent 86db415b18
commit d008ec926f
1 changed files with 3 additions and 0 deletions

View File

@ -739,6 +739,9 @@ public class YoutubeStreamExtractor extends StreamExtractor {
// todo: use this to apply auto translation to different language from a source language
final JsonArray autoCaptionsArray = renderer.getArray("translationLanguages", new JsonArray());
// captionsArray object may be null, e.g. https://www.youtube.com/watch?v=OyLafqSSJF8
if (captionsArray == null) return Collections.emptyList();
// This check is necessary since there may be cases where subtitles metadata do not contain caption track info
// e.g. https://www.youtube.com/watch?v=-Vpwatutnko
final int captionsSize = captionsArray.size();