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

On android 6.0, filter 0x00ad (unicode soft hyphen) from statuses #884

Merged
merged 1 commit into from Oct 15, 2018

Conversation

Tak
Copy link
Collaborator

@Tak Tak commented Oct 12, 2018

Works around #563

Tested with known offenders

The implementation isn't too elegant in reading-the-code terms, but I was pretty conscious about every status going through this codepath, so I tried to keep iteration and allocation to an absolute minimum.

return (Spanned) ReplaceCrashingCharacters((CharSequence) content);
}

static CharSequence ReplaceCrashingCharacters(CharSequence content) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

methods should start with lowercase character

Boolean replacing = false;
SpannableStringBuilder builder = null;

for (int index = 0; index < content.length(); ++index) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

its not guaranteed that length() is a simple getter, moving it out of the loop should be faster

@connyduck connyduck merged commit 25c3def into tuskyapp:master Oct 15, 2018
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