fix(Scout): fix error when unloading
This commit is contained in:
parent
2fdeef0280
commit
da07f17650
1 changed files with 3 additions and 1 deletions
|
|
@ -82,7 +82,7 @@ class Scout : Plugin() {
|
||||||
) as SearchAPIInterface
|
) as SearchAPIInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
private val origFilterTypes: Array<FilterType>? = null
|
private var origFilterTypes: Array<FilterType>? = null
|
||||||
// Creates new pseudo-values of the `FilterType` enum for date filters
|
// Creates new pseudo-values of the `FilterType` enum for date filters
|
||||||
@Suppress("LocalVariableName")
|
@Suppress("LocalVariableName")
|
||||||
private fun extendFilterType() {
|
private fun extendFilterType() {
|
||||||
|
|
@ -93,6 +93,7 @@ class Scout : Plugin() {
|
||||||
val field = cls.getDeclaredField("\$VALUES")
|
val field = cls.getDeclaredField("\$VALUES")
|
||||||
field.isAccessible = true
|
field.isAccessible = true
|
||||||
val values = field.get(null) as Array<FilterType>
|
val values = field.get(null) as Array<FilterType>
|
||||||
|
origFilterTypes = origFilterTypes ?: values
|
||||||
var nextIdx = values.size
|
var nextIdx = values.size
|
||||||
|
|
||||||
val BEFORE = constructor.newInstance("BEFORE", nextIdx++) as FilterType
|
val BEFORE = constructor.newInstance("BEFORE", nextIdx++) as FilterType
|
||||||
|
|
@ -119,6 +120,7 @@ class Scout : Plugin() {
|
||||||
val field = cls.getDeclaredField("\$VALUES")
|
val field = cls.getDeclaredField("\$VALUES")
|
||||||
field.isAccessible = true
|
field.isAccessible = true
|
||||||
field.set(null, origFilterTypes)
|
field.set(null, origFilterTypes)
|
||||||
|
origFilterTypes = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patches the search query to also insert `min_id`, required for searching "after:" and "during:"
|
// Patches the search query to also insert `min_id`, required for searching "after:" and "during:"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue