diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java index 5581e0c32..2616da0f1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java @@ -3334,10 +3334,12 @@ public class FHIRPathEngine { Base res = null; if (s.startsWith("#")) { Property p = context.rootResource.getChildByName("contained"); - for (Base c : p.getValues()) { - if (chompHash(s).equals(chompHash(c.getIdBase()))) { - res = c; - break; + if (p != null) { + for (Base c : p.getValues()) { + if (chompHash(s).equals(chompHash(c.getIdBase()))) { + res = c; + break; + } } } } else if (hostServices != null) {