fix for npe

This commit is contained in:
Grahame Grieve 2020-09-22 22:01:02 +10:00
parent 278697f72b
commit 5ada654ca2
1 changed files with 7 additions and 7 deletions

View File

@ -251,12 +251,12 @@ public class DataRenderer extends Renderer {
} else { } else {
return "No display for "+b.fhirType(); return "No display for "+b.fhirType();
} }
} }
public String display(DataType type) { public String display(DataType type) {
if (type.isEmpty()) if (type == null || type.isEmpty()) {
return ""; return "";
}
if (type instanceof Coding) { if (type instanceof Coding) {
return displayCoding((Coding) type); return displayCoding((Coding) type);
@ -354,7 +354,6 @@ public class DataRenderer extends Renderer {
} else { } else {
x.tx("No display for "+type.fhirType()); x.tx("No display for "+type.fhirType());
} }
} }
private void renderReference(XhtmlNode x, Reference ref) { private void renderReference(XhtmlNode x, Reference ref) {
@ -368,15 +367,17 @@ public class DataRenderer extends Renderer {
} }
public void renderDateTime(XhtmlNode x, Base e) { public void renderDateTime(XhtmlNode x, Base e) {
if (e.hasPrimitiveValue()) if (e.hasPrimitiveValue()) {
x.addText(((DateTimeType) e).toHumanDisplay()); x.addText(((DateTimeType) e).toHumanDisplay());
}
} }
protected void renderUri(XhtmlNode x, UriType uri) { 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)); x.ah(uri.getValue()).addText(uri.getValue().substring(7));
else } else {
x.ah(uri.getValue()).addText(uri.getValue()); x.ah(uri.getValue()).addText(uri.getValue());
}
} }
protected void renderUri(XhtmlNode x, UriType uri, String path, String id) { 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) { protected String displayQuantity(Quantity q) {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();