Skip to content

Commit

Permalink
Checking Zh-CN code length before looking for a blacklash symbol. (#3531
Browse files Browse the repository at this point in the history
)
  • Loading branch information
daoshengmu committed Jun 23, 2020
1 parent a569c88 commit 8d59870
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -147,8 +147,9 @@ public CandidatesResult getCandidates(String aComposingText) {

// When using backslashes ({@code \}) in the replacement string
// will cause crash at `replaceFirst()`, so we need to replace it first.
if (result.words.get(0).code.charAt(result.words.get(0).code.length() - 1)
== kBackslashCode) {
if (result.words.get(0).code.length() > 0 &&
result.words.get(0).code.charAt(result.words.get(0).code.length() - 1)
== kBackslashCode) {
newCode = result.words.get(0).code.replace("\\", "\\\\");
aComposingText = aComposingText.replace("\\", "\\\\");
}
Expand Down

0 comments on commit 8d59870

Please sign in to comment.