Issue 1694 NPE when no hints

git-svn-id: https://zxing.googlecode.com/svn/trunk@2812 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-05-29 11:46:20 +00:00
parent 2ecec34f74
commit 71d7987c28

View file

@ -37,8 +37,8 @@ public final class AztecWriter implements Writer {
@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) {
String charset = (String) hints.get(EncodeHintType.CHARACTER_SET);
Number eccPercent = (Number) hints.get(EncodeHintType.ERROR_CORRECTION);
String charset = hints == null ? null : (String) hints.get(EncodeHintType.CHARACTER_SET);
Number eccPercent = hints == null ? null : (Number) hints.get(EncodeHintType.ERROR_CORRECTION);
return encode(contents,
format,
charset == null ? DEFAULT_CHARSET : Charset.forName(charset),