Skip to content

Commit 26449cf

Browse files
committed
fix(Google Photos - GmsCore support): Fix by checking first if a method exists before trying to patch it
1 parent e4232b6 commit 26449cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ abstract class BaseGmsCoreSupportPatch(
5656
) : BytecodePatch(
5757
name = "GmsCore support",
5858
description = "Allows patched Google apps to run without root and under a different package name " +
59-
"by using GmsCore instead of Google Play Services.",
59+
"by using GmsCore instead of Google Play Services.",
6060
dependencies = setOf(
6161
ChangePackageNamePatch::class,
6262
gmsCoreSupportResourcePatch::class,
@@ -100,7 +100,13 @@ abstract class BaseGmsCoreSupportPatch(
100100
primeMethodFingerprint?.let { transformPrimeMethod(packageName) }
101101

102102
// Return these methods early to prevent the app from crashing.
103-
(earlyReturnFingerprints + ServiceCheckFingerprint + CastDynamiteModuleFingerprint).returnEarly()
103+
earlyReturnFingerprints.returnEarly()
104+
ServiceCheckFingerprint.returnEarly()
105+
// Not all apps have CastDynamiteModule, so we need to check if it's present.
106+
if (CastDynamiteModuleFingerprint.result != null) {
107+
CastDynamiteModuleFingerprint.returnEarly()
108+
}
109+
// Google Play Utility is not present in all apps, so we need to check if it's present.
104110
if (GooglePlayUtilityFingerprint.result != null) {
105111
GooglePlayUtilityFingerprint.returnEarly()
106112
}
@@ -109,7 +115,7 @@ abstract class BaseGmsCoreSupportPatch(
109115
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
110116
0,
111117
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
112-
"checkGmsCore(Landroid/app/Activity;)V",
118+
"checkGmsCore(Landroid/app/Activity;)V",
113119
) ?: throw mainActivityOnCreateFingerprint.exception
114120

115121
// Change the vendor of GmsCore in ReVanced Integrations.

0 commit comments

Comments
 (0)