Fixing NPE in accessing theme attribute.

Change-Id: I5d21645b5530f13e1709021bd818de6bdb1d6544
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index ef6fcb7..6f56ca6 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -3499,13 +3499,16 @@
         }
 
         // Get the primary color and update the RecentsActivityValues for this activity
-        TypedArray a = getTheme().obtainStyledAttributes(com.android.internal.R.styleable.Theme);
-        int colorPrimary = a.getColor(com.android.internal.R.styleable.Theme_colorPrimary, 0);
-        a.recycle();
-        if (colorPrimary != 0) {
-            ActivityManager.RecentsActivityValues v = new ActivityManager.RecentsActivityValues();
-            v.colorPrimary = colorPrimary;
-            setRecentsActivityValues(v);
+        Resources.Theme tmpTheme = getTheme();
+        if (tmpTheme != null) {
+            TypedArray a = tmpTheme.obtainStyledAttributes(com.android.internal.R.styleable.Theme);
+            int colorPrimary = a.getColor(com.android.internal.R.styleable.Theme_colorPrimary, 0);
+            a.recycle();
+            if (colorPrimary != 0) {
+                ActivityManager.RecentsActivityValues v = new ActivityManager.RecentsActivityValues();
+                v.colorPrimary = colorPrimary;
+                setRecentsActivityValues(v);
+            }
         }
     }