Merge "Check null before passing to Integer.parseInt"

This commit is contained in:
Yohei Yukawa 2014-03-24 14:21:26 +00:00 committed by Android (Google) Code Review
commit 8f1aba2e25

View file

@ -273,6 +273,9 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static int readKeyboardThemeIndex(final SharedPreferences prefs, final Resources res) {
final int defaultThemeIndex = readDefaultKeyboardThemeIndex(res);
final String themeIndexString = prefs.getString(PREF_KEYBOARD_LAYOUT, null);
if (themeIndexString == null) {
return defaultThemeIndex;
}
try {
return Integer.parseInt(themeIndexString);
} catch (final NumberFormatException e) {