Dont crash if there is no spellchecker
The fact that isSpellCheckerEnabled returns true does not mean that getCurrentSpellChecker will return non null. By default isSpellCheckerEnabled is true in TextServicesSettings, even when there is no spellchecker service active on the device. The issue can be verified by disabling the Google Keyboard (assuming the GMS LatinImeGoogle is used) in Settings|Apps and later entering Settings|Language & input. Without this patch Settings crashes at that point with the following stack: E/AndroidRuntime(13020): Caused by: java.lang.NullPointerException: \ Attempt to invoke virtual method 'java.lang.CharSequence android.vie\ w.textservice.SpellCheckerInfo.loadLabel(android.content.pm.PackageM\ anager)' on a null object reference E/AndroidRuntime(13020): at com.android.settings.inputmethod.\ InputMethodAndLanguageSettings.onResume(InputMethodAndLanguageSettin\ gs.java:253) E/AndroidRuntime(13020): at android.app.Fragment.performResum\ e(Fragment.java:2096) E/AndroidRuntime(13020): at android.app.FragmentManagerImpl.m\ oveToState(FragmentManager.java:928) E/AndroidRuntime(13020): at android.app.FragmentManagerImpl.m\ oveToState(FragmentManager.java:1067) Bug: 19832033 Change-Id: I65e6d269572e064aa6897807b6611ef947d90211
Loading
Please register or sign in to comment