From 5ada654ca2594585d1ee948829af70803c669838 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 22 Sep 2020 22:01:02 +1000 Subject: [PATCH] fix for npe --- .../org/hl7/fhir/r5/renderers/DataRenderer.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java index ac04d007d..2033956f9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java @@ -251,12 +251,12 @@ public class DataRenderer extends Renderer { } else { return "No display for "+b.fhirType(); } - } public String display(DataType type) { - if (type.isEmpty()) + if (type == null || type.isEmpty()) { return ""; + } if (type instanceof Coding) { return displayCoding((Coding) type); @@ -354,7 +354,6 @@ public class DataRenderer extends Renderer { } else { x.tx("No display for "+type.fhirType()); } - } private void renderReference(XhtmlNode x, Reference ref) { @@ -368,15 +367,17 @@ public class DataRenderer extends Renderer { } public void renderDateTime(XhtmlNode x, Base e) { - if (e.hasPrimitiveValue()) + if (e.hasPrimitiveValue()) { x.addText(((DateTimeType) e).toHumanDisplay()); + } } protected void renderUri(XhtmlNode x, UriType uri) { - if (uri.getValue().startsWith("mailto:")) + if (uri.getValue().startsWith("mailto:")) { x.ah(uri.getValue()).addText(uri.getValue().substring(7)); - else + } else { x.ah(uri.getValue()).addText(uri.getValue()); + } } protected void renderUri(XhtmlNode x, UriType uri, String path, String id) { @@ -782,7 +783,6 @@ public class DataRenderer extends Renderer { } } - protected String displayQuantity(Quantity q) { StringBuilder s = new StringBuilder();