Skip to content

Commit 5075f19

Browse files
committed
fix for-each loop with empty structure
1 parent 1dd37ce commit 5075f19

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/aem/core/src/main/java/com/cognifide/apm/core/grammar/ScriptRunner.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.cognifide.apm.api.status.Status;
2626
import com.cognifide.apm.core.grammar.ApmType.ApmEmpty;
2727
import com.cognifide.apm.core.grammar.ApmType.ApmList;
28+
import com.cognifide.apm.core.grammar.ApmType.ApmMap;
2829
import com.cognifide.apm.core.grammar.ApmType.ApmString;
2930
import com.cognifide.apm.core.grammar.antlr.ApmLangBaseVisitor;
3031
import com.cognifide.apm.core.grammar.antlr.ApmLangParser.AllowDenyCommandContext;
@@ -281,6 +282,8 @@ private List<Map<String, ApmType>> readValues(ForEachContext ctx) {
281282
values = variableValue.getList();
282283
} else if (variableValue instanceof ApmEmpty) {
283284
values = Collections.emptyList();
285+
} else if (variableValue instanceof ApmMap && variableValue.getMap().isEmpty()) {
286+
values = Collections.emptyList();
284287
} else {
285288
values = ImmutableList.of(variableValue);
286289
}

0 commit comments

Comments
 (0)