Skip to content
Snippets Groups Projects
Commit fe95e7b1 authored by Satoshi Kataoka's avatar Satoshi Kataoka Committed by Android (Google) Code Review
Browse files

Merge "Fix possible NPE"

parents 77f63c8a 6c8136d1
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ import android.preference.Preference; ...@@ -32,6 +32,7 @@ import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener; import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceGroup; import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.util.Log;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import java.util.TreeSet; import java.util.TreeSet;
...@@ -45,6 +46,7 @@ import com.android.inputmethodcommon.InputMethodSettingsFragment; ...@@ -45,6 +46,7 @@ import com.android.inputmethodcommon.InputMethodSettingsFragment;
public final class SettingsFragment extends InputMethodSettingsFragment public final class SettingsFragment extends InputMethodSettingsFragment
implements SharedPreferences.OnSharedPreferenceChangeListener { implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = SettingsFragment.class.getSimpleName();
private static final boolean DBG_USE_INTERNAL_USER_DICTIONARY_SETTINGS = false; private static final boolean DBG_USE_INTERNAL_USER_DICTIONARY_SETTINGS = false;
private ListPreference mVoicePreference; private ListPreference mVoicePreference;
...@@ -246,7 +248,14 @@ public final class SettingsFragment extends InputMethodSettingsFragment ...@@ -246,7 +248,14 @@ public final class SettingsFragment extends InputMethodSettingsFragment
@Override @Override
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) { public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
(new BackupManager(getActivity())).dataChanged(); final Activity activity = getActivity();
if (activity == null) {
// TODO: Introduce a static function to register this class and ensure that
// onCreate must be called before "onSharedPreferenceChanged" is called.
Log.w(TAG, "onSharedPreferenceChanged called before activity starts.");
return;
}
(new BackupManager(activity)).dataChanged();
final Resources res = getResources(); final Resources res = getResources();
if (key.equals(Settings.PREF_POPUP_ON)) { if (key.equals(Settings.PREF_POPUP_ON)) {
setPreferenceEnabled(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY, setPreferenceEnabled(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment