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:
parent
5f1dbd1056
commit
558c37cc94
1 changed files with 2 additions and 2 deletions
|
@ -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}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue