fix(Custom branding icon): displays an appropriate error if the path to patch options is invalid

This commit is contained in:
inotia00 2023-12-06 13:52:06 +09:00
parent 9b15d234e3
commit b81392a2d4
2 changed files with 29 additions and 21 deletions

View File

@ -68,6 +68,7 @@ object CustomBrandingIconPatch : ResourcePatch() {
directory, *mipmapIconResourceFileNames directory, *mipmapIconResourceFileNames
) )
}.let { resourceGroups -> }.let { resourceGroups ->
try {
val path = File(appIcon) val path = File(appIcon)
val resourceDirectory = context["res"] val resourceDirectory = context["res"]
@ -82,6 +83,9 @@ object CustomBrandingIconPatch : ResourcePatch() {
) )
} }
} }
} catch (_: Exception) {
throw PatchException("Invalid app icon path: $appIcon")
}
} }
} else { } else {
val resourcePath = "music/branding/$appIconValue" val resourcePath = "music/branding/$appIconValue"

View File

@ -113,6 +113,7 @@ object CustomBrandingIconPatch : ResourcePatch() {
directory, *mipmapIconResourceFileNames directory, *mipmapIconResourceFileNames
) )
}.let { resourceGroups -> }.let { resourceGroups ->
try {
val path = File(appIcon) val path = File(appIcon)
val resourceDirectory = context["res"] val resourceDirectory = context["res"]
@ -128,6 +129,9 @@ object CustomBrandingIconPatch : ResourcePatch() {
} }
} }
context.updatePatchStatusIcon("custom") context.updatePatchStatusIcon("custom")
} catch (_: Exception) {
throw PatchException("Invalid app icon path: $appIcon")
}
} }
} else { } else {
val resourcePath = "youtube/branding/$appIconValue" val resourcePath = "youtube/branding/$appIconValue"