diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt index 9e247f1e..186633e5 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt @@ -10,6 +10,8 @@ import org.jsoup.nodes.Document * * In all cases, parsing will be done from a JSoup document * Variants accepting strings are also permitted, and they will be converted to documents accordingly + * The return type must be nonnull if no parsing errors occurred, as null signifies a parse error + * If null really must be allowed, use Optionals */ interface FrostParser<T> { /** @@ -37,6 +39,7 @@ interface FrostParser<T> { } internal abstract class FrostParserBase<T> : FrostParser<T> { + override final fun parse(text: String?): T? { text ?: return null val doc = textToDoc(text) ?: return null |