Skip to content

Fix ArithmeticException crash on div_zero button tap#229

Open
sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-div-zero-crash-hx
Open

Fix ArithmeticException crash on div_zero button tap#229
sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-div-zero-crash-hx

Conversation

@sentry

@sentry sentry Bot commented Jun 24, 2026

Copy link
Copy Markdown

Summary

The div_zero button's click listener in MainActivity.java contained a hardcoded int t = 5 / 0 that threw an unhandled ArithmeticException, crashing the app every time the button was tapped.

Fix

Wrapped the division in a try-catch(ArithmeticException) block and report the exception to Sentry via Sentry.captureException(e), consistent with the existing handled-exception pattern used elsewhere in the same file.

How to verify

  1. Launch the app (com.example.vu.android).
  2. Navigate to MainActivity.
  3. Tap the div_zero button.
  4. The app no longer crashes — the exception is captured and reported to Sentry.

Fixes ANDROID-HX

The div_zero button's click listener contained a hardcoded 'int t = 5 / 0'
that threw an unhandled ArithmeticException, crashing the app. Wrap the
division in a try-catch and report the exception to Sentry instead.

Fixes ANDROID-HX
@sentry sentry Bot requested a review from sdzhong as a code owner June 24, 2026 20:40
@sentry

sentry Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Android com.example.vu.android 24.12.26 (241226) release
Android com.example.vu.android 24.12.26 (241226) debug
Android com.example.vu.android 24.12.26 (241226) release

⚙️ android Build Distribution Settings

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (fbd7a20) to head (66a29ec).

Files with missing lines Patch % Lines
...main/java/com/example/vu/android/MainActivity.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #229   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         16      16           
  Lines        875     878    +3     
  Branches      65      65           
=====================================
- Misses       875     878    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant