Merge pull request #1001 from ahdis/oe_np_with_structuremaps

fix np and index out of bound exception
This commit is contained in:
Grahame Grieve 2022-11-26 01:00:34 -03:00 committed by GitHub
commit e189ae2b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -228,7 +228,7 @@ public abstract class ParserBase {
if (!"id".equals(e.getName())) { if (!"id".equals(e.getName())) {
return true; return true;
} }
if (path.contains(".")) { if (path!=null && path.contains(".")) {
return idPolicy.forInner(); return idPolicy.forInner();
} else { } else {
return idPolicy.forRoot(); return idPolicy.forRoot();

View File

@ -1680,7 +1680,7 @@ public class StructureMapUtilities {
case EVALUATE: case EVALUATE:
ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION); ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION);
if (expr == null) { if (expr == null) {
expr = fpe.parse(getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString())); expr = fpe.parse(getParamStringNoNull(vars, tgt.getParameter().get(tgt.getParameter().size() - 1), tgt.toString()));
tgt.setUserData(MAP_EXPRESSION, expr); tgt.setUserData(MAP_EXPRESSION, expr);
} }
List<Base> v = fpe.evaluate(vars, null, null, tgt.getParameter().size() == 2 ? getParam(vars, tgt.getParameter().get(0)) : new BooleanType(false), expr); List<Base> v = fpe.evaluate(vars, null, null, tgt.getParameter().size() == 2 ? getParam(vars, tgt.getParameter().get(0)) : new BooleanType(false), expr);