From 9c1dec2f31e121b0f23a0270211961f3398445ac Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Mon, 11 Apr 2022 09:26:40 +0200 Subject: nullpointer exception fixed in dynamic content of dosipas --- .../barcode/dynamicContent/api/DynamicContentCoder.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 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 34406e0..00b5824 100644 --- a/src/main/java/org/uic/barcode/dynamicContent/api/DynamicContentCoder.java +++ b/src/main/java/org/uic/barcode/dynamicContent/api/DynamicContentCoder.java @@ -92,8 +92,12 @@ public class DynamicContentCoder { GeoCoordinateType asnPoint = new GeoCoordinateType(); - asnPoint.setLatitude(point.getLatitude()); - asnPoint.setLongitude(point.getLongitude()); + if (point.getLatitude() != null) { + asnPoint.setLatitude(point.getLatitude()); + } + if (point.getLongitude() != null) { + asnPoint.setLongitude(point.getLongitude()); + } if (point.getUnit() != IGeoUnitType.milliDegree && point.getUnit() != null){ asnPoint.setGeoUnit(GeoUnitType.valueOf(point.getUnit().name())); @@ -169,8 +173,12 @@ public class DynamicContentCoder { IGeoCoordinate g = new SimpleGeoCoordinate(); - g.setLatitude(asnCoordinate.getLatitude()); - g.setLongitude(asnCoordinate.getLongitude()); + if (asnCoordinate.getLatitude() != null) { + g.setLatitude(asnCoordinate.getLatitude()); + } + if (asnCoordinate.getLongitude() != null) { + g.setLongitude(asnCoordinate.getLongitude()); + } if (asnCoordinate.getCoordinateSystem() != null) { g.setSystem(IGeoCoordinateSystemType.valueOf(asnCoordinate.getCoordinateSystem().name())); -- cgit v1.2.3