Fix possible NPE in runScheduleNextAlarm.

Bug:7244877
Change-Id: Ifda7343cd154fc53a8b7e39fd747c3088f21a5eb
diff --git a/src/com/android/providers/calendar/CalendarAlarmManager.java b/src/com/android/providers/calendar/CalendarAlarmManager.java
index d917020..f25d3de 100644
--- a/src/com/android/providers/calendar/CalendarAlarmManager.java
+++ b/src/com/android/providers/calendar/CalendarAlarmManager.java
@@ -193,9 +193,13 @@
      * @param db TODO
      */
     void runScheduleNextAlarm(boolean removeAlarms, CalendarProvider2 cp2) {
+        SQLiteDatabase db = cp2.mDb;
+        if (db == null) {
+            return;
+        }
+
         // Reset so that we can accept other schedules of next alarm
         mNextAlarmCheckScheduled.set(false);
-        SQLiteDatabase db = cp2.mDb;
         db.beginTransaction();
         try {
             if (removeAlarms) {