Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SES-1889] Fix IndexOutOfBounds in MediaPreview #1481

Merged
merged 5 commits into from
May 29, 2024

Conversation

bemusementpark
Copy link

@bemusementpark bemusementpark commented May 14, 2024

The issue is a crash that occurs onResume we load the cursor again and then set the pager position and that triggers viewPagerListener, but the listener is reused and holds an index which may or may not be valid. As range checks only check index is positive, we might have an index that exceeds the bounds, and if leftIsRecent is set then its reversed. This commit fixes the issue and adds some additional info if we do throw.

It'd be good to rewrite this class in the near future

Th clamping in onLoadFinished also improves an issue when the Activity is started wiyh an inalid index causing the pager to not be populated at all when the activity is opened

Copy link
Collaborator

@AL-Session AL-Session left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good following Discord discussion. Approved.

@bemusementpark bemusementpark merged commit 34baa9d into oxen-io:dev May 29, 2024
1 check passed
@bemusementpark bemusementpark deleted the s1889 branch May 29, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants