fix: use 0 as last chance lastVersion fallback for limiter #1236
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.
This is a speculative fix for #1233 ankidroid/Anki-Android#14348
I'm not sure if 1) this is valid kotlin (I just tapped it out in the github web UI or 2) if I'm understanding the problem correctly
It is confusing to me how this (exception apparently from the original catch block...) could happen. I don't understand that and may be missing something simple
But if we end up in that catch block and then for whatever reason cannot go from Long to Integer, then at the very least we can avoid crashing an app on startup by simply using zero (or backup value in any case...) as a final "well, at least we tried..." value
I have no pride in the code or thought behind the solution, if it's terrible, close and we can all forget about it ;-). Would love to see #1233 fixed though