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

IndexOutOfBoundsExceptions when calling SmartMaterialSpinner#setSelection method #24

Closed
mochadwi opened this issue May 8, 2020 · 3 comments

Comments

@mochadwi
Copy link

mochadwi commented May 8, 2020

I'm curious about this line of code (highlighted)
Screen Shot 2020-05-08 at 9 44 05 AM

and see the implementation of hint will never be null, because you were always using "" a blanks/empty strings.
Screen Shot 2020-05-08 at 9 42 51 AM
both in setter line 1106 and 256

thus the code:
SmartMaterialSpinner.super.setSelection(hint != null ? finalPosition + 1 : finalPosition, false);

will always having a finalPosition + 1 means the index/position == item.size, IndexOutOfBoundsExceptions occurred

IMHO the rest of the nullability check will having a false-positive instead

cmiiw

@Chivorns
Copy link
Owner

Hi @mochadwi , thank for your feedback. I will check on it soon if it the root cause of that issue. Currently I'm a bit busy with company projects so cannot support you for now.
Please stay tune. Thank

@mochadwi
Copy link
Author

mochadwi commented May 13, 2020

If it's okay, I might open a PR for it @Chivorns

@Chivorns
Copy link
Owner

Okay @mochadwi . Much appreciate.

Chivorns added a commit that referenced this issue Apr 3, 2021
@Chivorns Chivorns closed this as completed Apr 3, 2021
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

No branches or pull requests

2 participants