am 95b51431: Merge "Null check for create event dialog fragment" into ics-ub-calendar-denim

* commit '95b51431844cd514dc2e59529f0439bf8bb6b09d':
  Null check for create event dialog fragment
diff --git a/src/com/android/calendar/event/CreateEventDialogFragment.java b/src/com/android/calendar/event/CreateEventDialogFragment.java
index 5eb69a1..0381b30 100644
--- a/src/com/android/calendar/event/CreateEventDialogFragment.java
+++ b/src/com/android/calendar/event/CreateEventDialogFragment.java
@@ -31,6 +31,7 @@
 import android.text.TextWatcher;
 import android.text.format.DateUtils;
 import android.text.format.Time;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.Button;
@@ -52,6 +53,8 @@
  */
 public class CreateEventDialogFragment extends DialogFragment implements TextWatcher {
 
+    private static final String TAG = "CreateEventDialogFragment";
+
     private static final int TOKEN_CALENDARS = 1 << 3;
 
     private static final String KEY_DATE_STRING = "date_string";
@@ -261,8 +264,15 @@
             return;
         }
 
-        String defaultCalendar = Utils.getSharedPreference(
-                getActivity(), GeneralPreferences.KEY_DEFAULT_CALENDAR, (String) null);
+
+        String defaultCalendar = null;
+        final Activity activity = getActivity();
+        if (activity != null) {
+            defaultCalendar = Utils.getSharedPreference(activity,
+                    GeneralPreferences.KEY_DEFAULT_CALENDAR, (String) null);
+        } else {
+            Log.e(TAG, "Activity is null, cannot load default calendar");
+        }
 
         int calendarOwnerIndex = cursor.getColumnIndexOrThrow(Calendars.OWNER_ACCOUNT);
         int accountNameIndex = cursor.getColumnIndexOrThrow(Calendars.ACCOUNT_NAME);