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

Commit a233cf5

Browse files
committed
Fixed using backslash crash in Java 1.4.
1 parent b06ac39 commit a233cf5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ public CandidatesResult getCandidates(String aComposingText) {
7878
}
7979

8080
// Autocomplete when special characters are clicked
81+
final char kBackslashCode = 92;
8182
char lastChar = aComposingText.charAt(aComposingText.length() - 1);
83+
84+
// When using backslashes ({@code \}) in the replacement string
85+
// will cause crash at `replaceFirst()`, so we need to replace it first.
86+
if (lastChar == kBackslashCode) {
87+
aComposingText = aComposingText.replace("\\", "\\\\");
88+
}
8289
boolean autocomponse = mAutocompleteEndings.indexOf(lastChar) >= 0;
8390

8491
aComposingText = aComposingText.replaceAll("\\s","");

0 commit comments

Comments
 (0)