Only allocate a StringBuffer if the start pattern has been found successfully in...
[zxing.git] / core / src / com / google / zxing / oned / ITFReader.java
index 9af0d1a..b3613ab 100644 (file)
@@ -77,14 +77,12 @@ public final class ITFReader extends AbstractOneDReader {
 \r
   public Result decodeRow(int rowNumber, BitArray row, Hashtable hints) throws ReaderException {\r
 \r
-    StringBuffer result = new StringBuffer(20);\r
-\r
     // Find out where the Middle section (payload) starts & ends\r
     int[] startRange = decodeStart(row);\r
     int[] endRange = decodeEnd(row);\r
 \r
+    StringBuffer result = new StringBuffer(20);\r
     decodeMiddle(row, startRange[1], endRange[0], result);\r
-\r
     String resultString = result.toString();\r
 \r
     int[] allowedLengths = null;\r