mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
Don't crash on unsupported barcode format like CODE_93
git-svn-id: https://zxing.googlecode.com/svn/trunk@2266 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
18c3b38a9a
commit
5af1cad965
|
@ -313,7 +313,13 @@ final class QRCodeEncoder {
|
|||
hints.put(EncodeHintType.CHARACTER_SET, encoding);
|
||||
}
|
||||
MultiFormatWriter writer = new MultiFormatWriter();
|
||||
BitMatrix result = writer.encode(contentsToEncode, format, dimension, dimension, hints);
|
||||
BitMatrix result;
|
||||
try {
|
||||
result = writer.encode(contentsToEncode, format, dimension, dimension, hints);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// Unsupported format
|
||||
return null;
|
||||
}
|
||||
int width = result.getWidth();
|
||||
int height = result.getHeight();
|
||||
int[] pixels = new int[width * height];
|
||||
|
|
Loading…
Reference in a new issue