Fix crash when encountering null PendingIntent.

This commit is contained in:
Cody Henthorne
2021-08-02 13:14:55 -04:00
committed by Greyson Parrelli
parent 4a52532256
commit 065a39992a
2 changed files with 11 additions and 5 deletions

View File

@@ -31,7 +31,11 @@ public abstract class PersistentAlarmManagerListener extends BroadcastReceiver {
Log.i(TAG, getClass() + " scheduling for: " + scheduledTime + " action: " + intent.getAction());
alarmManager.cancel(pendingIntent);
alarmManager.set(AlarmManager.RTC_WAKEUP, scheduledTime, pendingIntent);
if (pendingIntent != null) {
alarmManager.cancel(pendingIntent);
alarmManager.set(AlarmManager.RTC_WAKEUP, scheduledTime, pendingIntent);
} else {
Log.i(TAG, "PendingIntent somehow null, skipping");
}
}
}