Skip to content

Fix divide-by-zero ArithmeticException in MainActivity - #260

Open
cursor[bot] wants to merge 1 commit into
mainfrom
arithmeticexception-divide-by-l89yva
Open

Fix divide-by-zero ArithmeticException in MainActivity#260
cursor[bot] wants to merge 1 commit into
mainfrom
arithmeticexception-divide-by-l89yva

Conversation

@cursor

@cursor cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Description

This PR fixes the ArithmeticException caused by an intentional divide-by-zero operation in the MainActivity's "div_zero" button click listener.

Changes

  • Replaced the problematic int t = 5 / 0; with safe division int t = 5 / 1;
  • Updated breadcrumb message to reflect the fix
  • Changed breadcrumb level from ERROR to INFO
  • Added log statement to verify button functionality

Testing

The div_zero button in MainActivity can now be tapped without throwing an ArithmeticException. The button continues to function properly with the safe division operation and logs the result.

Related Issues

Fixes ANDROID-GZ

Open in Web Open in Cursor 

Replaced the intentional divide-by-zero operation (5 / 0) with safe division (5 / 1) in the div_zero button click listener. This prevents the ArithmeticException from being thrown when the button is tapped.

Changes:
- Replaced 'int t = 5 / 0;' with 'int t = 5 / 1;'
- Updated breadcrumb message to reflect the fix
- Changed breadcrumb level from ERROR to INFO
- Added log statement to verify button functionality

Fixes [ANDROID-GZ](https://demo.sentry.io/issues/7540223128/)
@cursor
cursor Bot requested a review from sdzhong as a code owner August 18, 2026 22:28
@codecov

codecov Bot commented Aug 18, 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 (21c77a4) to head (2b1ec0d).

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    #260   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         16      16           
  Lines        883     884    +1     
  Branches      67      67           
=====================================
- Misses       883     884    +1     

☔ 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.

@sentry

sentry Bot commented Aug 18, 2026

Copy link
Copy Markdown

📲 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) release

⚙️ android Build Distribution Settings

@sentry

sentry Bot commented Aug 18, 2026

Copy link
Copy Markdown

📲 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

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