am 8f1aba2e: Merge "Check null before passing to Integer.parseInt"
* commit '8f1aba2e25837a7737ab463f6580b6238407a635': Check null before passing to Integer.parseIntmain
commit
9aa2f8a764
|
@ -273,6 +273,9 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static int readKeyboardThemeIndex(final SharedPreferences prefs, final Resources res) {
|
public static int readKeyboardThemeIndex(final SharedPreferences prefs, final Resources res) {
|
||||||
final int defaultThemeIndex = readDefaultKeyboardThemeIndex(res);
|
final int defaultThemeIndex = readDefaultKeyboardThemeIndex(res);
|
||||||
final String themeIndexString = prefs.getString(PREF_KEYBOARD_LAYOUT, null);
|
final String themeIndexString = prefs.getString(PREF_KEYBOARD_LAYOUT, null);
|
||||||
|
if (themeIndexString == null) {
|
||||||
|
return defaultThemeIndex;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(themeIndexString);
|
return Integer.parseInt(themeIndexString);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
|
|
Loading…
Reference in New Issue