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:
Yarpopcat08
2026-07-18 16:47:37 +04:00
committed by GitHub
parent 2e0d341b69
commit d9f7e2444a

View File

@@ -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));
}
});
});