fix(source/local): Don't crash trying to get manga language

XML is pain
This commit is contained in:
Ahmad Ansori Palembani 2024-12-10 10:29:28 +07:00
parent 1cb635999e
commit 119b1c64b2
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -69,11 +69,18 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
.filter { !it.isDirectory }
.firstOrNull { it.name == COMIC_INFO_FILE }
return if (localDetails != null) {
decodeComicInfo(localDetails.openInputStream()).language?.value ?: "other"
val lang = if (localDetails != null) {
try {
decodeComicInfo(localDetails.openInputStream()).language?.value
} catch (e: Exception) {
Logger.e(e) { "Unable to retrieve manga language" }
null
}
} else {
"other"
null
}
return lang ?: "other"
}
}