From d168c0a7ac481c2aed2c2276e7315ecd80dfa76f Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Mon, 18 Dec 2023 10:58:32 +0800 Subject: [PATCH] fix(epubreader): ignore progression without locator Closes: #1352 --- komga-webui/src/functions/readium.ts | 30 ++++++++++++++++------------ komga-webui/src/views/EpubReader.vue | 6 +++--- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/komga-webui/src/functions/readium.ts b/komga-webui/src/functions/readium.ts index 79cb786f0..041627cf4 100644 --- a/komga-webui/src/functions/readium.ts +++ b/komga-webui/src/functions/readium.ts @@ -32,18 +32,22 @@ function locationsToR2Location(location: Locations): R2Location { } } -export function r2ProgressionToReadingPosition(progression: R2Progression): ReadingPosition { - return { - created: progression.modified, - href: progression.locator.href, - type: progression.locator.type, - title: progression.locator.title, - locations: { - fragment: progression.locator.locations.fragment ? progression.locator.locations.fragment[0] : undefined, - position: progression.locator.locations.position, - progression: progression.locator.locations.progression, - totalProgression: progression.locator.locations.totalProgression, - }, - text: progression.locator.text, +export function r2ProgressionToReadingPosition(progression?: R2Progression): ReadingPosition | undefined { + try { + return { + created: progression.modified, + href: progression.locator.href, + type: progression.locator.type, + title: progression.locator.title, + locations: { + fragment: progression.locator.locations.fragment ? progression.locator.locations.fragment[0] : undefined, + position: progression.locator.locations.position, + progression: progression.locator.locations.progression, + totalProgression: progression.locator.locations.totalProgression, + }, + text: progression.locator.text, + } + } catch (e) { + return undefined } } diff --git a/komga-webui/src/views/EpubReader.vue b/komga-webui/src/views/EpubReader.vue index 35c249e08..d11a94160 100644 --- a/komga-webui/src/views/EpubReader.vue +++ b/komga-webui/src/views/EpubReader.vue @@ -298,7 +298,7 @@