From d56e7ebbe8c65b2150214eb3254d36226c1c42a6 Mon Sep 17 00:00:00 2001 From: Patrick Scott Date: Mon, 12 Oct 2009 08:35:36 -0400 Subject: [PATCH] Avoid a NPE in the monkey by checking for a null alarm. --- src/com/android/alarmclock/SetAlarm.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/alarmclock/SetAlarm.java b/src/com/android/alarmclock/SetAlarm.java index 312cf92..7e041f6 100644 --- a/src/com/android/alarmclock/SetAlarm.java +++ b/src/com/android/alarmclock/SetAlarm.java @@ -93,6 +93,11 @@ public class SetAlarm extends PreferenceActivity /* load alarm details from database */ Alarm alarm = Alarms.getAlarm(getContentResolver(), mId); + // Bad alarm, bail to avoid a NPE. + if (alarm == null) { + finish(); + return; + } mEnabled = alarm.enabled; mLabel.setText(alarm.label); mLabel.setSummary(alarm.label); -- 2.11.0