From 5acdc268ac95045dab26409ab62885bfa9731a84 Mon Sep 17 00:00:00 2001 From: Quentin Gliosca Date: Thu, 8 Dec 2022 13:43:09 +0100 Subject: [PATCH] Make ContentService.content not nullable --- .../shared/publication/services/content/ContentService.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readium/shared/src/main/java/org/readium/r2/shared/publication/services/content/ContentService.kt b/readium/shared/src/main/java/org/readium/r2/shared/publication/services/content/ContentService.kt index b53d3ce3fc..00cd125816 100644 --- a/readium/shared/src/main/java/org/readium/r2/shared/publication/services/content/ContentService.kt +++ b/readium/shared/src/main/java/org/readium/r2/shared/publication/services/content/ContentService.kt @@ -25,7 +25,7 @@ interface ContentService : Publication.Service { * The implementation must be fast and non-blocking. Do the actual extraction inside the * [Content] implementation. */ - fun content(start: Locator?): Content? + fun content(start: Locator?): Content } /** @@ -64,8 +64,8 @@ class DefaultContentService( } } - override fun content(start: Locator?): Content? { - val publication = publication() ?: return null + override fun content(start: Locator?): Content { + val publication = publication() ?: throw IllegalStateException("No Publication object") return ContentImpl(publication, start) }