am 21c43016: Merge "Dont crash if there is no spellchecker"

* commit '21c430160fe6d9a6e53600ac350e3661802b85aa':
  Dont crash if there is no spellchecker
This commit is contained in:
Jason Monk
2015-06-03 13:56:51 +00:00
committed by Android Git Automerger

View File

@@ -254,8 +254,9 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
if (spellChecker != null) { if (spellChecker != null) {
final TextServicesManager tsm = (TextServicesManager) getSystemService( final TextServicesManager tsm = (TextServicesManager) getSystemService(
Context.TEXT_SERVICES_MANAGER_SERVICE); Context.TEXT_SERVICES_MANAGER_SERVICE);
if (tsm.isSpellCheckerEnabled()) {
final SpellCheckerInfo sci = tsm.getCurrentSpellChecker(); final SpellCheckerInfo sci = tsm.getCurrentSpellChecker();
spellChecker.setEnabled(sci != null);
if (tsm.isSpellCheckerEnabled() && sci != null) {
spellChecker.setSummary(sci.loadLabel(getPackageManager())); spellChecker.setSummary(sci.loadLabel(getPackageManager()));
} else { } else {
spellChecker.setSummary(R.string.switch_off_text); spellChecker.setSummary(R.string.switch_off_text);