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.

Change-Id: Ifcd1358bdee69d06877510e0eafe88aa43021780