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

Parser fails on } { sequence #203

Open
tomaszkruzel opened this issue Sep 15, 2017 · 0 comments
Open

Parser fails on } { sequence #203

tomaszkruzel opened this issue Sep 15, 2017 · 0 comments

Comments

@tomaszkruzel
Copy link

After trying to call IconTextView.setText with text that contains { } in reversed order,i.e.:
text}{
text}text{text

ParsingUtil fails with error:

java.lang.StringIndexOutOfBoundsException: length=37; regionStart=36; regionLength=-37
at java.lang.String.startEndAndLength(String.java:504)
at java.lang.String.substring(String.java:1333)
at com.joanzapata.iconify.internal.ParsingUtil.recursivePrepareSpannableIndexes(ParsingUtil.java:103)
at com.joanzapata.iconify.internal.ParsingUtil.parse(ParsingUtil.java:37)
at com.joanzapata.iconify.Iconify.compute(Iconify.java:59)
at com.joanzapata.iconify.widget.IconTextView.setText(IconTextView.java:34)

I am aware that { } is a pattern. But I believe reversed order of } { could be detected by the parser to avoid the crash.

In my case this part of iconified text comes from user input, so I am forced to sanitize the text.

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

1 participant