mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Avoid an NPE in Arrays.asList
git-svn-id: https://zxing.googlecode.com/svn/trunk@2121 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
035320bd2f
commit
d4cd1c4b58
|
@ -282,11 +282,11 @@ final class QRCodeEncoder {
|
||||||
|
|
||||||
private void encodeQRCodeContents(AddressBookParsedResult contact) {
|
private void encodeQRCodeContents(AddressBookParsedResult contact) {
|
||||||
ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder();
|
ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder();
|
||||||
String[] encoded = encoder.encode(Arrays.asList(contact.getNames()),
|
String[] encoded = encoder.encode(toIterable(contact.getNames()),
|
||||||
contact.getOrg(),
|
contact.getOrg(),
|
||||||
Arrays.asList(contact.getAddresses()),
|
toIterable(contact.getAddresses()),
|
||||||
Arrays.asList(contact.getPhoneNumbers()),
|
toIterable(contact.getPhoneNumbers()),
|
||||||
Arrays.asList(contact.getEmails()),
|
toIterable(contact.getEmails()),
|
||||||
contact.getURL(),
|
contact.getURL(),
|
||||||
null);
|
null);
|
||||||
// Make sure we've encoded at least one field.
|
// Make sure we've encoded at least one field.
|
||||||
|
@ -297,6 +297,10 @@ final class QRCodeEncoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Iterable<String> toIterable(String[] values) {
|
||||||
|
return values == null ? null : Arrays.asList(values);
|
||||||
|
}
|
||||||
|
|
||||||
Bitmap encodeAsBitmap() throws WriterException {
|
Bitmap encodeAsBitmap() throws WriterException {
|
||||||
Map<EncodeHintType,Object> hints = null;
|
Map<EncodeHintType,Object> hints = null;
|
||||||
String encoding = guessAppropriateEncoding(contents);
|
String encoding = guessAppropriateEncoding(contents);
|
||||||
|
|
Loading…
Reference in a new issue