Skip to content

Fix NegativeArraySizeException in MainActivity#224

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
negativearraysizeexception--5-aqxews
Draft

Fix NegativeArraySizeException in MainActivity#224
cursor[bot] wants to merge 1 commit into
mainfrom
negativearraysizeexception--5-aqxews

Conversation

@cursor

@cursor cursor Bot commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Fixed the NegativeArraySizeException that occurs when tapping the 'negative_index' button in MainActivity.

Changes

  • Changed array allocation from new int[-5] to new int[5] on line 61 of MainActivity.java
  • This prevents the runtime exception that was caused by attempting to create an array with a negative size

Testing

The fix resolves the crash that occurred when:

  1. Launching the Android app
  2. Navigating to MainActivity
  3. Tapping the 'NegativeArraySizeException' button (view id: negative_index)

Fixes ANDROID-HW

Open in Web Open in Cursor 

Fixes ANDROID-HW

Changed the hardcoded negative array size from -5 to 5 in the button click listener
to prevent NegativeArraySizeException from being thrown when the user taps the
'negative_index' button.
@sentry

sentry Bot commented Jun 16, 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 Jun 16, 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 (fbd7a20) to head (4c51e2a).

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    #224   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         16      16           
  Lines        875     875           
  Branches      65      65           
=====================================
  Misses       875     875           

☔ 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