Skip to content

Commit 8456a56

Browse files
antonisclaude
andcommitted
fix(feedback): use instanceof check for SentryAndroidOptions cast
Follow the established defensive pattern used by all other Android integrations instead of an unchecked cast that could throw ClassCastException if a hybrid SDK passes a different options type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e89af4f commit 8456a56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ public FeedbackShakeIntegration(final @NotNull Application application) {
3737

3838
@Override
3939
public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions sentryOptions) {
40-
this.options = (SentryAndroidOptions) sentryOptions;
40+
this.options =
41+
Objects.requireNonNull(
42+
(sentryOptions instanceof SentryAndroidOptions)
43+
? (SentryAndroidOptions) sentryOptions
44+
: null,
45+
"SentryAndroidOptions is required");
4146

4247
if (!this.options.getFeedbackOptions().isUseShakeGesture()) {
4348
return;

0 commit comments

Comments
 (0)