Fix NPE in Settings -> Language & input -> Default -> Setup input methods

If the InputMethodAndLanguageSettings fragment is launched in IME-only
mode, it removes most preferences, so we need to null-check them before
use.