From 66a29ec7a8a4950a4f93daff1e5894543172b652 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 24 Jun 2026 20:40:41 +0000 Subject: [PATCH] Wrap div-zero button handler in try-catch to prevent crash The div_zero button's click listener contained a hardcoded 'int t = 5 / 0' that threw an unhandled ArithmeticException, crashing the app. Wrap the division in a try-catch and report the exception to Sentry instead. Fixes ANDROID-HX --- app/src/main/java/com/example/vu/android/MainActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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..3c20e58 100644 --- a/app/src/main/java/com/example/vu/android/MainActivity.java +++ b/app/src/main/java/com/example/vu/android/MainActivity.java @@ -50,7 +50,11 @@ protected void onCreate(Bundle savedInstanceState) { bc.setData("url", "https://sentry.io"); Sentry.addBreadcrumb(bc); - int t = 5 / 0; + try { + int t = 5 / 0; + } catch (ArithmeticException e) { + Sentry.captureException(e); + } }); // Unhandled - NegativeArraySizeException