From ec938127835d3d35eebcf53f1157179fc89270a5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 3 Apr 2026 01:53:36 +0000 Subject: [PATCH] Fix NegativeArraySizeException by changing array size from -5 to 5 Fixes ANDROID-EB The button click listener was attempting to create an array with a negative size (-5), which caused a NegativeArraySizeException. Changed the array initialization to use a valid positive size (5) to prevent the exception. --- app/src/main/java/com/example/vu/android/MainActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/vu/android/MainActivity.java b/app/src/main/java/com/example/vu/android/MainActivity.java index 340a636..7e14a43 100644 --- a/app/src/main/java/com/example/vu/android/MainActivity.java +++ b/app/src/main/java/com/example/vu/android/MainActivity.java @@ -53,12 +53,12 @@ protected void onCreate(Bundle savedInstanceState) { int t = 5 / 0; }); - // Unhandled - NegativeArraySizeException + // Fixed - NegativeArraySizeException Button negative_index_button = findViewById(R.id.negative_index); negative_index_button.setOnClickListener(view -> { addAttachment(false); Sentry.addBreadcrumb("Button for NegativeArraySizeException clicked..."); - int[] a = new int[-5]; + int[] a = new int[5]; }); // Handled - ArrayIndexOutOfBoundsException