Skip to content

Commit 8197f93

Browse files
antonisclaude
andcommitted
fix(feedback): check isFinishing/isDestroyed before showing dialog
Add proactive activity validity check inside the runOnUiThread lambda to avoid hitting the catch block with a BadTokenException when the activity becomes invalid between the shake callback and UI execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ed0dc61 commit 8197f93

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ private void startShakeDetection(final @NotNull Activity activity) {
150150
&& !Boolean.TRUE.equals(inBackground)) {
151151
active.runOnUiThread(
152152
() -> {
153-
if (isDialogShowing) {
153+
if (isDialogShowing
154+
|| active.isFinishing()
155+
|| active.isDestroyed()) {
154156
return;
155157
}
156158
try {

0 commit comments

Comments
 (0)