From 44f3079ffeb5cdb6d5338b48f0a6460c24f2503e Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Mon, 11 Apr 2022 09:39:35 +0200 Subject: nullpointer --- .../dynamicContent/api/DynamicContentCoder.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main/java/org/uic/barcode/dynamicContent/api/DynamicContentCoder.java b/src/main/java/org/uic/barcode/dynamicContent/api/DynamicContentCoder.java index ea90879..b49bcb9 100644 --- a/src/main/java/org/uic/barcode/dynamicContent/api/DynamicContentCoder.java +++ b/src/main/java/org/uic/barcode/dynamicContent/api/DynamicContentCoder.java @@ -57,21 +57,25 @@ public class DynamicContentCoder { private static SequenceOfExtension getAsnContentExtensions(UicDynamicContentDataFDC1 asn, List dynamicContentResponseList) throws EncodingFormatException { - if (dynamicContentResponseList != null && !dynamicContentResponseList.isEmpty()){ + if (dynamicContentResponseList == null || dynamicContentResponseList.isEmpty()){ + return null; + } - SequenceOfExtension asnList = asn.getExtensions(); - if (asnList == null) asnList = new SequenceOfExtension(); - for (IExtension extension : dynamicContentResponseList){ - ExtensionData asnExtension = getAsnExtension(extension); - if (asnExtension!= null) { - asnList.add(asnExtension); - } - } - if (!asnList.isEmpty()){ - return asnList; + SequenceOfExtension asnList = asn.getExtensions(); + if (asnList == null) { + asnList = new SequenceOfExtension(); + } + + for (IExtension extension : dynamicContentResponseList){ + ExtensionData asnExtension = getAsnExtension(extension); + if (asnExtension!= null) { + asnList.add(asnExtension); } } - + if (!asnList.isEmpty()){ + return asnList; + } + return null; } -- cgit v1.2.3