mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-08-02 11:46:08 -04:00
fix: handle NumberFormatException in renderer settings (#305)
* fix: handle NumberFormatException in renderer settings * fix(LauncherPreferenceRendererSettingsFragment): mg cache error not localized Signed-off-by: tomikun <60690056+alexytomi@users.noreply.github.com> --------- Signed-off-by: tomikun <60690056+alexytomi@users.noreply.github.com> Co-authored-by: tomikun <60690056+alexytomi@users.noreply.github.com>
This commit is contained in:
@@ -48,11 +48,11 @@ public class LauncherPreferenceRendererSettingsFragment extends LauncherPreferen
|
||||
if (editText.getText().toString().isEmpty()) {
|
||||
editText.setText("0");
|
||||
}
|
||||
if (Long.parseLong(editText.getText().toString()) > Integer.MAX_VALUE) {
|
||||
editText.setError("Too big! Setting to maximum value");
|
||||
editText.setText(String.valueOf(Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
try {
|
||||
if (Long.parseLong(editText.getText().toString()) <= Integer.MAX_VALUE) return;
|
||||
} catch (NumberFormatException ignored) {}
|
||||
editText.setError(requireContext().getText(R.string.error_invalid_value));
|
||||
editText.setText(String.valueOf(Integer.MAX_VALUE));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user