mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-28 07:50:34 +05:30
Fix possible bug when language.id field is not present and this the languageCode an empty String.
This commit is contained in:
parent
b9282bbe94
commit
6a0f6e846a
@ -33,6 +33,7 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;
|
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;
|
||||||
|
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||||
|
|
||||||
public class PeertubeStreamExtractor extends StreamExtractor {
|
public class PeertubeStreamExtractor extends StreamExtractor {
|
||||||
private final String baseUrl;
|
private final String baseUrl;
|
||||||
@ -400,7 +401,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||||||
final String languageCode = JsonUtils.getString(caption, "language.id");
|
final String languageCode = JsonUtils.getString(caption, "language.id");
|
||||||
final String ext = url.substring(url.lastIndexOf(".") + 1);
|
final String ext = url.substring(url.lastIndexOf(".") + 1);
|
||||||
final MediaFormat fmt = MediaFormat.getFromSuffix(ext);
|
final MediaFormat fmt = MediaFormat.getFromSuffix(ext);
|
||||||
if (fmt != null && languageCode != null)
|
if (fmt != null && !isNullOrEmpty(languageCode))
|
||||||
subtitles.add(new SubtitlesStream(fmt, languageCode, url, false));
|
subtitles.add(new SubtitlesStream(fmt, languageCode, url, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user