OSDN Git Service

Avoid NullPointerException when updating preference intents
authorCarsten Hauge <carsten.hauge@sonymobile.com>
Mon, 7 Jul 2014 07:36:07 +0000 (09:36 +0200)
committerYoshinori Hirano <Yoshinori.Hirano@sonymobile.com>
Mon, 2 Oct 2017 02:01:49 +0000 (02:01 +0000)
Comparisons changed on the intent action. Sometimes an account
preference intent does not have an action specified.

Fixes: 67075850
Test: manual - go to Settings > Users & accounts and tap an account.

Change-Id: I54cebbc983b55aa1487a122d37ccd5c79bbf519d

src/com/android/settings/accounts/AccountTypePreferenceLoader.java

index 87aec14..0e19dab 100644 (file)
@@ -34,6 +34,7 @@ import android.support.v7.preference.Preference;
 import android.support.v7.preference.Preference.OnPreferenceClickListener;
 import android.support.v7.preference.PreferenceGroup;
 import android.support.v7.preference.PreferenceScreen;
+import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.settings.R;
@@ -135,8 +136,8 @@ public class AccountTypePreferenceLoader {
                 // startPreferencePanel() there. In order to inject the title string there, more
                 // dirty further hack is still needed. It's much easier and cleaner to listen to
                 // preference click event here directly.
-                if (intent.getAction().equals(
-                    android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)) {
+                if (TextUtils.equals(intent.getAction(),
+                        android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)) {
                     // The OnPreferenceClickListener overrides the click event completely. No intent
                     // will get fired.
                     pref.setOnPreferenceClickListener(new FragmentStarter(