3
3
Fork 1
mirror of https://github.com/recloudstream/cloudstream.git synced 2024-08-15 01:53:11 +00:00

Handle potential exception when converting date

This commit is contained in:
EdgarPi 2024-07-23 12:10:19 +02:00
parent 5f1dbd1056
commit 558c37cc94

View file

@ -449,12 +449,12 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
null,
null,
plot = this.node.synopsis,
releaseDate = if (this.node.start_date == null) null else Date.from(
releaseDate = if (this.node.start_date == null) null else try {Date.from(
Instant.from(
DateTimeFormatter.ofPattern(if (this.node.start_date.length == 4) "yyyy" else if (this.node.start_date.length == 7) "yyyy-MM" else "yyyy-MM-dd")
.parse(this.node.start_date)
)
)
)} catch (_: RuntimeException) {null}
)
}
}