Ensure to always have one page in reader

Current logic requires at least one page.
In case a chapter did not have any page a TypeError occured
This commit is contained in:
schroda
2025-01-30 00:19:05 +01:00
parent 3698c19aba
commit 2c4a17b32f

View File

@@ -34,7 +34,8 @@ export const useReaderSetPagesState = (
useEffect(() => {
const pagesPayload = pagesResponse.data?.fetchChapterPages;
if (pagesPayload) {
const { pages: newPages } = pagesPayload;
const { pages } = pagesPayload;
const newPages = pages.length ? pages : [''];
const initialReaderPageIndex = getInitialReaderPageIndex(
resumeMode,