Fix NPE rendering bundles

This commit is contained in:
Grahame Grieve 2022-07-20 11:24:34 +10:00
parent e150b50f54
commit 421162d146
1 changed files with 4 additions and 1 deletions

View File

@ -167,6 +167,9 @@ public class BundleRenderer extends ResourceRenderer {
}
private ResourceWrapper resolveReference(List<BaseWrapper> entries, Base base) throws UnsupportedEncodingException, FHIRException, IOException {
if (base == null) {
return null;
}
Property prop = base.getChildByName("reference");
if (prop.hasValues()) {
String ref = prop.getValues().get(0).primitiveValue();
@ -195,7 +198,7 @@ public class BundleRenderer extends ResourceRenderer {
Resource subject = resolveReference(b, comp.getSubject());
if (subject != null) {
XhtmlNode nx = (subject instanceof DomainResource) ? ((DomainResource) subject).getText().getDiv() : null;
if (nx != null) {
if (nx != null && !nx.isEmpty()) {
x.addChildren(nx);
} else {
RendererFactory.factory(subject, context).render(x, subject);