bug 1030738 - NullPointerException when getting action bar r=rnewman
authorBrad Lassey <blassey@mozilla.com>
Thu, 26 Jun 2014 09:41:42 -0400
changeset 191859 d33ca5cb5df3602a43dc3848a731a00d29ce7fa7
parent 191858 97203a8ac74b94e8a329a2703b30066ba964534d
child 191860 5f65faec9280160de9f4cbad674d1a48b15424cb
push id45685
push usercbook@mozilla.com
push dateWed, 02 Jul 2014 13:09:48 +0000
treeherdermozilla-inbound@60133a85f8ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1030738
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1030738 - NullPointerException when getting action bar r=rnewman
mobile/android/base/preferences/GeckoPreferenceFragment.java
mobile/android/base/preferences/GeckoPreferences.java
--- a/mobile/android/base/preferences/GeckoPreferenceFragment.java
+++ b/mobile/android/base/preferences/GeckoPreferenceFragment.java
@@ -117,17 +117,19 @@ public class GeckoPreferenceFragment ext
             return;
         }
 
         Log.v(LOGTAG, "Setting activity title to " + newTitle);
         activity.setTitle(newTitle);
 
         if (Build.VERSION.SDK_INT >= 14) {
             final ActionBar actionBar = activity.getActionBar();
-            actionBar.setTitle(newTitle);
+            if (actionBar != null) {
+                actionBar.setTitle(newTitle);
+            }
         }
     }
 
     @Override
     public void onResume() {
         // This is a little delicate. Ensure that you do nothing prior to
         // super.onResume that you wouldn't do in onCreate.
         applyLocale(Locale.getDefault());
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -135,17 +135,19 @@ OnSharedPreferenceChangeListener
 
     private void updateActionBarTitle(int title) {
         if (Build.VERSION.SDK_INT >= 14) {
             final String newTitle = getString(title);
             if (newTitle != null) {
                 Log.v(LOGTAG, "Setting action bar title to " + newTitle);
 
                 final ActionBar actionBar = getActionBar();
-                actionBar.setTitle(newTitle);
+                if (actionBar != null) {
+                    actionBar.setTitle(newTitle);
+                }
             }
         }
     }
 
     private void updateTitle(String newTitle) {
         if (newTitle != null) {
             Log.v(LOGTAG, "Setting activity title to " + newTitle);
             setTitle(newTitle);
@@ -355,17 +357,19 @@ OnSharedPreferenceChangeListener
                     return longClickListener.onLongClick(view);
                 }
                 return false;
             }
         });
 
         if (Build.VERSION.SDK_INT >= 14) {
             final ActionBar actionBar = getActionBar();
-            actionBar.setHomeButtonEnabled(true);
+            if (actionBar != null) {
+                actionBar.setHomeButtonEnabled(true);
+            }
         }
 
         // N.B., if we ever need to redisplay the locale selection UI without
         // just finishing and recreating the activity, right here we'll need to
         // capture EXTRA_SHOW_FRAGMENT_TITLE from the intent and store the title ID.
 
         // If launched from notification, explicitly cancel the notification.
         if (intentExtras != null && intentExtras.containsKey(DataReportingNotification.ALERT_NAME_DATAREPORTING_NOTIFICATION)) {