Skip to content

Commit 8784de2

Browse files
Fix Bundle type check to avoid ClassCastException warnings
Changed from try-catch to type check with Bundle.get() to avoid Android logging warnings when color values are strings.
1 parent f8f2bf2 commit 8784de2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetAppearance.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,9 @@ private fun dynamicColorFromParams(
511511
}
512512

513513
// First check if it's a nested Bundle { "light": "#RRGGBB", "dark": "#RRGGBB" }
514-
val colorBundle =
515-
try {
516-
params.getBundle(key)
517-
} catch (e: ClassCastException) {
518-
null
519-
}
514+
val value = params.get(key)
515+
val colorBundle = if (value is Bundle) value else null
516+
520517
if (colorBundle != null) {
521518
val isDark =
522519
(

0 commit comments

Comments
 (0)