-
Notifications
You must be signed in to change notification settings - Fork 124
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
EmptyPlaceHolder causes IndexOutOfBoundsException on MaterialListValueBox#getValue #751
Comments
Are you working on this one? Otherwise I would make a fork. (I suppose Also it seems that calling |
- when a placeholder item is added as the very first item in the `#listBox` (`#setEmptyplaceHolder(String)`) a null value is added into the `#values` field, so their lengths match - public methods that dealt with item index are now made protected and called by their replacements that also add or subtract 1 (`#getIndexOffset()`) to reflect the offset caused by the extra (null) value representing the `#emptyPlaceHolder`; - added an `#emptyPlaceHolder` field, so the placeholder is preserved across clean() calls
A pull request has been created with a fix. Anyways, maybe a more clear solution/approach to the |
@jzaruba Can you please add a test case for any new features to avoid regressions in the future. |
I don't think its necessary to hide it. |
@kevzlou7979 I did not consider this one a new feature, rather a bug-fix. |
Selecting the very last item in the list and then calling MaterialListValueBox#getValue causes IndexOutOfBoundsException. This is because MaterialListValueBox#setEmptyPlaceHolder adds a new item into the list but does not add a new value into the array of the underlying model.
MaterialListValueBox#setEmptyPlaceHolder:
I did not think this through at all, but maybe adding a null value at the 0-index of the underlying array could work? (Unless someone will beat me to it I shall look into it during this upcoming week.)
The text was updated successfully, but these errors were encountered: