Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 8d59870

Browse files
authored
Checking Zh-CN code length before looking for a blacklash symbol. (#3531)
1 parent a569c88 commit 8d59870

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/ChinesePinyinKeyboard.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ public CandidatesResult getCandidates(String aComposingText) {
147147

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

0 commit comments

Comments
 (0)