Skip to content

Commit

Permalink
issue 39 - fixed index out of range bug
Browse files Browse the repository at this point in the history
  • Loading branch information
boriwo committed Apr 8, 2015
1 parent 4f1f156 commit fb67ee1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/comcast/cmb/common/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static boolean isValidUnicode(String msg) {
for (int i = 0; i < chs.length; i++) {
if (chs[i] == '\n' || chs[i] == '\t' || chs[i] == '\r' || (chs[i] >= '\u0020' && chs[i] <= '\uD7FF') || (chs[i] >= '\uE000' && chs[i] <= '\uFFFD')) {
continue;
} else if (i<chs.length) { // check for 4 bytes unicode, 2 char (utf16)
} else if (i<chs.length-1) { // check for 4 bytes unicode, 2 char (utf16)
if ((chs[i] >= '\uD800' && chs[i+1] >= '\uDC00') && (chs[i] <= '\uDBFF' && chs[i+1] <= '\uDFFF')) {
i++; // skip the next char
continue;
Expand Down

0 comments on commit fb67ee1

Please sign in to comment.