diff --git a/test/test_utils.py b/test/test_utils.py index 2be4ec7320..b95c8cdae5 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -807,6 +807,8 @@ class TestUtil(unittest.TestCase): testPL(5, 2, (0, 3), [0, 1, 2]) testPL(5, 2, (1, 4), [1, 2, 3]) testPL(5, 2, (2, 99), [2, 3, 4]) + testPL(5, 2, (0, 0), []) + testPL(5, 2, (2, 1), []) testPL(5, 2, (20, 99), []) def test_read_batch_urls(self): diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py index 3ed29bffd1..f176edba23 100644 --- a/yt_dlp/utils/_utils.py +++ b/yt_dlp/utils/_utils.py @@ -2337,6 +2337,8 @@ class PagedList: return page_results def getslice(self, start=0, end=None): + if end is not None and start >= end: + return [] return list(self._getslice(start, end)) def _getslice(self, start, end):