Fixed a crash with using SCAN_FORMATS - Pattern.split() does not like null as an argument.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1323 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2010-04-29 22:07:11 +00:00
parent 10116044ec
commit 43dfd0053f

View file

@ -264,11 +264,14 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
}
private static Vector<BarcodeFormat> parseDecodeFormats(Intent intent) {
return parseDecodeFormats(
Arrays.asList(COMMA_PATTERN.split(intent.getStringExtra(Intents.Scan.SCAN_FORMATS))),
intent.getStringExtra(Intents.Scan.MODE));
String formats = intent.getStringExtra(Intents.Scan.SCAN_FORMATS);
if (formats != null) {
return parseDecodeFormats(Arrays.asList(COMMA_PATTERN.split(formats)),
intent.getStringExtra(Intents.Scan.MODE));
}
return null;
}
private static Vector<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
List<String> formats = inputUri.getQueryParameters(Intents.Scan.SCAN_FORMATS);
if (formats.size() == 1){
@ -276,7 +279,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
}
return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
}
private static Vector<BarcodeFormat> parseDecodeFormats(List<String> scanFormats,
String decodeMode) {
if (scanFormats != null) {