Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
fix: only check once for patch options
Browse files Browse the repository at this point in the history
This prevents checking for the same patches options multiple times when it is already determined to not have any options
  • Loading branch information
oSumAtrIX committed Aug 24, 2023
1 parent a5851f0 commit 11c3a6c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/kotlin/app/revanced/utils/Options.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ internal object Options {

val patchOptions = deserialize(json)

patches.forEach { patch ->
patches.forEach patch@{ patch ->
patchOptions.find { option -> option.patchName == patch.patchName }?.let {
it.options.forEach { option ->
try {
patch.options?.set(option.key, option.value)
?: logger.warning("${patch.patchName} has no options")
?: run{
logger.warning("${patch.patchName} has no options")
return@patch
}
} catch (e: NoSuchOptionException) {
logger.info(e.message ?: "Unknown error")
logger.info(e.toString())
}
}
}
Expand Down

0 comments on commit 11c3a6c

Please sign in to comment.