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
diff --git a/core/src/com/google/zxing/client/result/VCardResultParser.java b/core/src/com/google/zxing/client/result/VCardResultParser.java
index 56cd6c2..5c82fe8 100644
--- a/core/src/com/google/zxing/client/result/VCardResultParser.java
+++ b/core/src/com/google/zxing/client/result/VCardResultParser.java
@@ -140,8 +140,8 @@
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 @@
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);