[Kavita] Patch - Fix for null cast exception (#19382)
* Fixed missing check if smart-filter is not loaded (due to not being any in kavita instance) Handled fetch errors more broadly * Bump version
This commit is contained in:
parent
b5f67c3778
commit
0530949ecb
|
@ -1,12 +1,19 @@
|
||||||
|
## 1.3.13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Fixed 'null cannot be cast to non-null type' exception
|
||||||
|
|
||||||
## 1.3.12
|
## 1.3.12
|
||||||
|
|
||||||
## Features
|
### Features
|
||||||
|
|
||||||
* Migrate filters to v2
|
* Migrate filters to v2
|
||||||
* Implemented smartFilters
|
* Implemented smartFilters
|
||||||
* Added localization support
|
* Added localization support
|
||||||
|
|
||||||
## Fixed
|
### Fixed
|
||||||
|
|
||||||
* Fixed publication status not showing
|
* Fixed publication status not showing
|
||||||
|
|
||||||
## 1.3.10
|
## 1.3.10
|
||||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Kavita'
|
extName = 'Kavita'
|
||||||
pkgNameSuffix = 'all.kavita'
|
pkgNameSuffix = 'all.kavita'
|
||||||
extClass = '.KavitaFactory'
|
extClass = '.KavitaFactory'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -125,12 +125,17 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
|
||||||
// Get Http code
|
// Get Http code
|
||||||
val field = throwable.javaClass.getDeclaredField("code")
|
val field = throwable.javaClass.getDeclaredField("code")
|
||||||
field.isAccessible = true // Make the field accessible
|
field.isAccessible = true // Make the field accessible
|
||||||
var code = field.get(throwable) // Get the value of the code property
|
try {
|
||||||
Log.e(LOG_TAG, "Error fetching manga: ${throwable.message}", throwable)
|
var code = field.get(throwable) // Get the value of the code property
|
||||||
if (code as Int !in intArrayOf(401, 201, 500)) {
|
Log.e(LOG_TAG, "Error fetching manga: ${throwable.message}", throwable)
|
||||||
code = 500
|
if (code as Int !in intArrayOf(401, 201, 500)) {
|
||||||
|
code = 500
|
||||||
|
}
|
||||||
|
return@onErrorResumeNext Observable.error(IOException("Http Error: $code\n ${helper.intl["http_errors_$code"]}\n${helper.intl["check_version"]}"))
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(LOG_TAG, e.toString(), e)
|
||||||
|
return@onErrorResumeNext Observable.error(e)
|
||||||
}
|
}
|
||||||
return@onErrorResumeNext Observable.error(IOException("Http Error: $code\n ${helper.intl["http_errors_$code"]}\n${helper.intl["check_version"]}"))
|
|
||||||
}
|
}
|
||||||
.map { response ->
|
.map { response ->
|
||||||
popularMangaParse(response)
|
popularMangaParse(response)
|
||||||
|
@ -188,10 +193,15 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
val newFilter = MetadataPayload() // need to reset it or will double
|
val newFilter = MetadataPayload() // need to reset it or will double
|
||||||
val smartFilterFilter = filters.find { it is SmartFiltersFilter }
|
val smartFilterFilter = filters.find { it is SmartFiltersFilter }
|
||||||
|
|
||||||
// If a SmartFilter selected, apply its filter and return that
|
// If a SmartFilter selected, apply its filter and return that
|
||||||
if (smartFilterFilter?.state != 0) {
|
if (smartFilterFilter?.state != 0 && smartFilterFilter != null) {
|
||||||
val index = smartFilterFilter?.state as Int - 1
|
val index = try {
|
||||||
|
smartFilterFilter?.state as Int - 1
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(LOG_TAG, e.toString(), e)
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
val filter: SmartFilter = smartFilters[index]
|
val filter: SmartFilter = smartFilters[index]
|
||||||
val payload = buildJsonObject {
|
val payload = buildJsonObject {
|
||||||
put("EncodedFilter", filter.filter)
|
put("EncodedFilter", filter.filter)
|
||||||
|
|
|
@ -11,7 +11,7 @@ object KavitaInt {
|
||||||
SPANISH,
|
SPANISH,
|
||||||
SPANISH_LATAM,
|
SPANISH_LATAM,
|
||||||
NORWEGIAN,
|
NORWEGIAN,
|
||||||
FRENCH
|
FRENCH,
|
||||||
)
|
)
|
||||||
const val KAVITA_NAME = "Kavita"
|
const val KAVITA_NAME = "Kavita"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue