Maybe avoid a string index out of bounds exception here?

git-svn-id: https://zxing.googlecode.com/svn/trunk@2265 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-04-26 17:02:45 +00:00
parent a1601d1bb8
commit 18c3b38a9a

View file

@ -140,8 +140,8 @@ public final class VCardResultParser extends ResultParser {
rawText.charAt(i+1) == '\t')) {
i += 2; // Skip \n and continutation whitespace
} else if (quotedPrintable && // If preceded by = in quoted printable
(rawText.charAt(i-1) == '=' || // this is a continuation
rawText.charAt(i-2) == '=')) {
((i >= 1 && rawText.charAt(i-1) == '=') || // this is a continuation
(i >= 2 && rawText.charAt(i-2) == '='))) {
i++; // Skip \n
} else {
break;
@ -156,7 +156,7 @@ public final class VCardResultParser extends ResultParser {
if (matches == null) {
matches = new ArrayList<List<String>>(1); // lazy init
}
if (rawText.charAt(i-1) == '\r') {
if (i >= 1 && rawText.charAt(i-1) == '\r') {
i--; // Back up over \r, which really should be there
}
String element = rawText.substring(matchStart, i);