fix: avoid NumberFormatException on String > Integer.MAX_INT #17505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose / Description
In the settings -> backups section you can paste whatever you want (or type whatever you want) number-wise into the prefs
If you put something too large in there (like, 9999999999) then you'll crash
This uses an internal function already special built for this, to not crash
Fixes
https://ankidroid.org/acra/app/1/bug/249351/report/5d5ad546-4725-4cf3-b93f-b601b26f4cde
Approach
Realize we already had a safe String-to-int function, expose it for use, use it
How Has This Been Tested?
Reproduced the crash locally, doesn't crash after
Reproduced all other number dialog and increment dialog behavior after, seems to work
Learning (optional, can help others)
Users are monkeys and they'll input anything (but it's okay, I'm a monkey too)
Checklist
Please, go through these checks before submitting the PR.