Skip to content

Fix ArithmeticException in div_zero button handler - #261

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

Fix ArithmeticException in div_zero button handler#261
cursor[bot] wants to merge 1 commit into
mainfrom
arithmeticexception-divide-by-okyq2u

Conversation

@cursor

@cursor cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Description

Fixed the ArithmeticException that was thrown when clicking the 'div_zero' button in MainActivity.

Changes

  • Changed the divisor from 0 to 1 in the div_zero button click listener (line 53)
  • This prevents the ArithmeticException: divide by zero from being thrown

Root Cause

The button click listener was unconditionally executing int t = 5 / 0, causing an ArithmeticException on every click. The divisor was hardcoded as 0 with no guard.

Fixes ANDROID-GZ

Open in Web Open in Cursor 

Changed divisor from 0 to 1 to prevent ArithmeticException when the div_zero button is clicked.

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:29
@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

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (21c77a4) to head (f0a9bfb).

Files with missing lines Patch % Lines
...main/java/com/example/vu/android/MainActivity.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #261   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         16      16           
  Lines        883     883           
  Branches      67      67           
=====================================
  Misses       883     883           

☔ 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