Skip to content

Guard against negative array size in MainActivity - #273

Open
sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-negative-array-size-01K5EJ7X
Open

sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-negative-array-size-01K5EJ7X

Conversation

@sentry

@sentry sentry Bot commented Sep 17, 2026

Copy link
Copy Markdown

This pull request was triggered by a Seer handoff from Sentry.

Root cause: The click listener for the negative_index button in MainActivity allocated new int[-5] directly. Java rejects negative array sizes, so every tap threw an unhandled NegativeArraySizeException and crashed the app.

Solution: The requested array size is now held in a variable and validated before the allocation. If it is negative, the listener reports an IllegalArgumentException to Sentry as a handled event (consistent with the other handled-error buttons) and returns without allocating, so the app no longer crashes.

Fixes ANDROID-NG

The 'negative_index' button allocated `new int[-5]`, which always threw an
unhandled NegativeArraySizeException and crashed the app on tap. Validate the
requested size before allocating and report the invalid size to Sentry as a
handled event instead of crashing.

Fixes [ANDROID-NG](https://demo.sentry.io/issues/7734837700/)
@sentry
sentry Bot requested a review from sdzhong as a code owner September 17, 2026 02:00
@sentry

sentry Bot commented Sep 17, 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 Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

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

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

☔ 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