From 11c3a6cfd4fe59ba5d703358634a1853e1cc22a5 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 24 Aug 2023 15:52:12 +0200 Subject: [PATCH] fix: only check once for patch options This prevents checking for the same patches options multiple times when it is already determined to not have any options --- src/main/kotlin/app/revanced/utils/Options.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/utils/Options.kt b/src/main/kotlin/app/revanced/utils/Options.kt index 534e32bd..408e2039 100644 --- a/src/main/kotlin/app/revanced/utils/Options.kt +++ b/src/main/kotlin/app/revanced/utils/Options.kt @@ -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()) } } }