fix npe rendering extensions + improve base64 presentation

This commit is contained in:
Grahame Grieve 2023-07-07 05:00:51 +10:00
parent 2cb7c052af
commit 0004e06a5d
1 changed files with 3 additions and 2 deletions

View File

@ -420,7 +420,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
private String getExtensionLabel(Extension ext) {
StructureDefinition sd = context.getWorker().fetchResource(StructureDefinition.class, ext.getUrl());
if (sd != null && ext.getValue().isPrimitive() && sd.hasSnapshot()) {
if (sd != null && ext.hasValue() && ext.getValue().isPrimitive() && sd.hasSnapshot()) {
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (Utilities.existsInList(ed.getPath(), "Extension", "Extension.value[x]") && ed.hasLabel()) {
return ed.getLabel();
@ -728,7 +728,8 @@ public class DataRenderer extends Renderer implements CodeResolver {
} else if (type instanceof MarkdownType) {
addMarkdown(x, ((MarkdownType) type).asStringValue());
} else if (type instanceof Base64BinaryType) {
x.tx("(base64 data)");
Base64BinaryType b64 = (Base64BinaryType) type;
x.tx("(base64 data - "+(b64.getValue() == null ? "0" : b64.getValue().length)+" bytes)");
} else if (type.isPrimitive()) {
x.tx(type.primitiveValue());
} else {