From 69d2a12a2b1c8d08d3986dffc98529ee95db9e40 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 21 Aug 2023 16:29:54 +1000 Subject: [PATCH] fix bug handling invalid codes when expanding --- .../fhir/r5/terminologies/expansion/ValueSetExpander.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/expansion/ValueSetExpander.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/expansion/ValueSetExpander.java index 763fa7c3b..940d82155 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/expansion/ValueSetExpander.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/expansion/ValueSetExpander.java @@ -877,9 +877,9 @@ public class ValueSetExpander extends ValueSetProcessBase { def.checkNoModifiers("Code in Code System", "expanding"); inactive = CodeSystemUtilities.isInactive(cs, def); isAbstract = CodeSystemUtilities.isNotSelectable(cs, def); + addCode(dwc, inc.getSystem(), c.getCode(), !Utilities.noString(c.getDisplay()) ? c.getDisplay() : def.getDisplay(), c.hasDisplay() ? vsSrc.getLanguage() : cs.getLanguage(), null, mergeDesignations(def, convertDesignations(c.getDesignation())), + expParams, isAbstract, inactive, imports, noInactive, false, exp.getProperty(), makeCSProps(def.getDefinition(), def.getProperty()), null, def.getExtension(), c.getExtension(), exp); } - addCode(dwc, inc.getSystem(), c.getCode(), !Utilities.noString(c.getDisplay()) ? c.getDisplay() : def == null ? null : def.getDisplay(), c.hasDisplay() ? vsSrc.getLanguage() : cs.getLanguage(), null, mergeDesignations(def, convertDesignations(c.getDesignation())), - expParams, isAbstract, inactive, imports, noInactive, false, exp.getProperty(), def == null ? null : makeCSProps(def.getDefinition(), def.getProperty()), null, def == null ? null : def.getExtension(), c.getExtension(), exp); } } if (inc.getFilter().size() > 0) { @@ -963,7 +963,9 @@ public class ValueSetExpander extends ValueSetProcessBase { private List mergeDesignations(ConceptDefinitionComponent def, List list) { List res = new ArrayList<>(); - res.addAll(def.getDesignation()); + if (def != null) { + res.addAll(def.getDesignation()); + } res.addAll(list); return res; }