Skip to content

A feature-rich command-line audio/video downloader

[fd/hls] Fix crash on empty fragment lists in tests (#17218)

doe1080aefce1eea4d0
diff --git a/yt_dlp/downloader/hls.py b/yt_dlp/downloader/hls.py
index 58cfbbf163..ad49e3f56f 100644
--- a/yt_dlp/downloader/hls.py
+++ b/yt_dlp/downloader/hls.py
@@ -300,7 +300,7 @@ class HlsFD(FragmentFD):
# We only download the first fragment during the test
if self.params.get('test', False):
- fragments = [fragments[0] if fragments else None]
+ fragments = fragments[:1]
if real_downloader:
info_dict['fragments'] = fragments