workaround NPE in summary renderer

This commit is contained in:
Grahame Grieve 2020-02-13 21:21:07 +11:00
parent 42853db493
commit db2c862b1e
1 changed files with 12 additions and 8 deletions

View File

@ -5311,15 +5311,19 @@ public class ProfileUtilities extends TranslatingUtilities {
private String getCardinality(ElementDefinition ed, List<ElementDefinition> list) {
int min = ed.getMin();
int max = !ed.hasMax() || ed.getMax().equals("*") ? Integer.MAX_VALUE : Integer.parseInt(ed.getMax());
while (ed != null && ed.getPath().contains(".")) {
ed = findParent(ed, list);
if (ed.getMax().equals("0"))
ElementDefinition ned = ed;
while (ned != null && ned.getPath().contains(".")) {
ned = findParent(ned, list);
if (ned != null) { // todo: this can happen if we've walked into a resoruce. Not sure what to about that?
if ("0".equals(ned.getMax()))
max = 0;
else if (!ed.getMax().equals("1") && !ed.hasSlicing())
else if (!ned.getMax().equals("1") && !ned.hasSlicing())
max = Integer.MAX_VALUE;
if (ed.getMin() == 0)
if (ned.getMin() == 0) {
min = 0;
}
}
}
return Integer.toString(min)+".."+(max == Integer.MAX_VALUE ? "*" : Integer.toString(max));
}