Skip to content

Commit 6f75cd2

Browse files
committed
Fix(@inquirer/core): Fixes usePagination assuming the list is never empty
1 parent f2c4983 commit 6f75cd2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/core/src/lib/pagination/lines.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export function lines<T>({
5555
isActive: index === active,
5656
}));
5757
const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
58-
const renderItemAt = (index: number) => split(renderItem(layoutsInPage[index]!), width);
58+
const renderItemAt = (index: number) =>
59+
layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);
5960

6061
// Create a blank array of lines for the page
6162
const pageBuffer: string[] = Array.from({ length: pageSize });

0 commit comments

Comments
 (0)