Fix NullPointerException in NumberPickerPreferenceDialogFragment

This commit is contained in:
Mygod
2016-10-14 00:18:28 +08:00
parent 7d099b1faf
commit 52ead0a02c
@@ -30,7 +30,8 @@ class NumberPickerPreferenceDialogFragment extends PreferenceDialogFragment {
val value = picker.getValue
if (preference.callChangeListener(value)) preference.setValue(value)
}
inputMethodManager.hideSoftInputFromWindow(getActivity.getCurrentFocus.getWindowToken,
InputMethodManager.HIDE_NOT_ALWAYS)
val focus = getActivity.getCurrentFocus
if (focus != null)
inputMethodManager.hideSoftInputFromWindow(focus.getWindowToken, InputMethodManager.HIDE_NOT_ALWAYS)
}
}