File tree 1 file changed +8
-3
lines changed
src/commonMain/kotlin/app/revanced/library
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,16 @@ private val logger = Logger.getLogger("Options")
19
19
* @param options The options to set. The key is the patch name and the value is a map of option keys to option values.
20
20
*/
21
21
fun Set <Patch <* >>.setOptions (options : PatchesOptions ) = filter { it.name != null }.forEach { patch ->
22
- val patchOptions = options[patch.name] ? : return @forEach
22
+ options[patch.name]?.forEach setOption@{ (optionKey, optionValue) ->
23
+ if (optionKey !in patch.options) {
24
+ return @setOption logger.warning(
25
+ " Could not set option for the \" ${patch.name} \" patch because " +
26
+ " option with key \" ${optionKey} \" does not exist" ,
27
+ )
28
+ }
23
29
24
- patch.options.forEach option@{ option ->
25
30
try {
26
- patch.options[option.key ] = patchOptions[option.key] ? : return @option
31
+ patch.options[optionKey ] = optionValue
27
32
} catch (e: OptionException ) {
28
33
logger.warning(" Could not set option value for the \" ${patch.name} \" patch: ${e.message} " )
29
34
}
You can’t perform that action at this time.
0 commit comments