Fix NegativeArraySizeException in MainActivity#221
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed the NegativeArraySizeException crash in MainActivity by correcting the array allocation size from -5 to 5.
Changes
new int[-5]tonew 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