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

Fix SiblingConstraint Crash: Add Size check before getting child #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MrFast-js
Copy link

The new code checks if index - 1 is possible for the children array, and if its not return the value without it, this is better than before because before if the children's size changes quickly, in my case for a search bar only showing certain results, and sometimes it would crash, this fixes that crash.

@DJtheRedstoner
Copy link
Member

If I'm understanding correctly, this is for cases where component.parent.children.indexOf(component) is -1, but this being true seems like it would only occur when something "illegal" is being done (like operations from another thread). Can you provide a minimal example that reproduces this, if it is really a bug that should be fixed in Elementa?

@MrFast-js
Copy link
Author

yes @DJtheRedstoner, I have run into this crash when quickly hiding and unhiding elements, in this example its when I press the features "options" button (the gear) that can be found on lines #649-661, I can't force it to happen, and seemed to happen almost randomly when clicking on the gear, sometimes it would crash other times it would be fine, but the times it did crash it always pointed to that file having a input of -1 and it checking children[-2] thus crashing with array out of bounds . here it the example: https://github.com/MrFast-js/Skyblock-Tweaks/blob/main/src/main/java/mrfast/sbt/config/ConfigGui.kt#L649-L661

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.

None yet

2 participants