Skip to content

Commit c4ecc46

Browse files
Catch null pointer exception from InstallReferrer libraries (#1271)
1 parent 68f1480 commit c4ecc46

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Branch-SDK/src/main/java/io/branch/coroutines/InstallReferrers.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ suspend fun getSamsungGalaxyStoreReferrerDetails(context: Context): InstallRefer
163163
null,
164164
null
165165
)
166-
} catch (e: RemoteException) {
167-
BranchLogger.w("Caught getSamsungGalaxyStoreReferrerDetails exception: $e")
166+
}
167+
catch (e: Exception) {
168+
BranchLogger.e("Caught getSamsungGalaxyStoreReferrerDetails exception: $e")
168169
null
169170
}
170171
)
@@ -196,6 +197,7 @@ suspend fun getSamsungGalaxyStoreReferrerDetails(context: Context): InstallRefer
196197

197198
suspend fun getXiaomiGetAppsReferrerDetails(context: Context): InstallReferrerResult? {
198199
return withContext(Dispatchers.Default) {
200+
// Install Referrer API availability varies between Xiaomi's MIUI and HyperOS
199201
if(classExists(xiaomiInstallReferrerClass)) {
200202
try {
201203
val deferredReferrerDetails = CompletableDeferred<InstallReferrerResult?>()
@@ -217,8 +219,8 @@ suspend fun getXiaomiGetAppsReferrerDetails(context: Context): InstallReferrerRe
217219
result.installBeginTimestampServerSeconds,
218220
result.referrerClickTimestampServerSeconds
219221
)
220-
} catch (e: RemoteException) {
221-
BranchLogger.w("Caught getXiaomiGetAppsReferrerDetails exception: $e")
222+
} catch (e: Exception) {
223+
BranchLogger.e("Caught getXiaomiGetAppsReferrerDetails exception: $e")
222224
null
223225
}
224226
)

0 commit comments

Comments
 (0)