Skip to content

Fix NegativeArraySizeException in MainActivity#221

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

Fix NegativeArraySizeException in MainActivity#221
cursor[bot] wants to merge 1 commit into
mainfrom
negativearraysizeexception--5-3k5phi

Conversation

@cursor

@cursor cursor Bot commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Fixed the NegativeArraySizeException crash in MainActivity by correcting the array allocation size from -5 to 5.

Changes

  • Changed new int[-5] to new int[5] in the negative_index button's click listener (line 61)

Root Cause

The negative_index button's click listener was intentionally allocating an int array with a hardcoded negative size (-5), which caused the JVM to throw a NegativeArraySizeException and crash the app.

Fix

Updated the array allocation to use a positive size (5), preventing the crash while maintaining the button's functionality.

Fixes ANDROID-GY

Open in Web Open in Cursor 

Fixes ANDROID-GY

Changed the negative array allocation in the negative_index button's
click listener from new int[-5] to new int[5] to prevent the
NegativeArraySizeException crash.
@codecov

codecov Bot commented Jun 10, 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 (814e302) to head (47ab0ac).

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

☔ 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