fix: fix the fix for the fix for MangaUpdates
null is better than a crash
This commit is contained in:
parent
04538c52f2
commit
58d5b5bc41
2 changed files with 3 additions and 3 deletions
|
@ -993,7 +993,7 @@ fun countDown(media: Media, view: ViewGroup) {
|
||||||
fun sinceWhen(media: Media, view: ViewGroup) {
|
fun sinceWhen(media: Media, view: ViewGroup) {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
MangaUpdates().search(media.name ?: media.nameRomaji, media.startDate)?.let {
|
MangaUpdates().search(media.name ?: media.nameRomaji, media.startDate)?.let {
|
||||||
val latestChapter = MangaUpdates.getLatestChapter(it)
|
val latestChapter = MangaUpdates.getLatestChapter(it) ?: return@let
|
||||||
val timeSince = (System.currentTimeMillis() -
|
val timeSince = (System.currentTimeMillis() -
|
||||||
(it.metadata.series.lastUpdated!!.timestamp * 1000)) / 1000
|
(it.metadata.series.lastUpdated!!.timestamp * 1000)) / 1000
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ class MangaUpdates {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getLatestChapter(results: MangaUpdatesResponse.Results): Int {
|
fun getLatestChapter(results: MangaUpdatesResponse.Results): Int? {
|
||||||
return results.metadata.series.latestChapter
|
return results.metadata.series.latestChapter
|
||||||
?: results.record.chapter!!.substringAfterLast("-").trim().toInt()
|
?: results.record.chapter!!.substringAfterLast("-").trim().toIntOrNull()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue