Skip to content

Commit

Permalink
fix for-each loop with empty structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dprzybyl committed Nov 2, 2023
1 parent 1dd37ce commit 5075f19
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.cognifide.apm.api.status.Status;
import com.cognifide.apm.core.grammar.ApmType.ApmEmpty;
import com.cognifide.apm.core.grammar.ApmType.ApmList;
import com.cognifide.apm.core.grammar.ApmType.ApmMap;
import com.cognifide.apm.core.grammar.ApmType.ApmString;
import com.cognifide.apm.core.grammar.antlr.ApmLangBaseVisitor;
import com.cognifide.apm.core.grammar.antlr.ApmLangParser.AllowDenyCommandContext;
Expand Down Expand Up @@ -281,6 +282,8 @@ private List<Map<String, ApmType>> readValues(ForEachContext ctx) {
values = variableValue.getList();
} else if (variableValue instanceof ApmEmpty) {
values = Collections.emptyList();
} else if (variableValue instanceof ApmMap && variableValue.getMap().isEmpty()) {
values = Collections.emptyList();
} else {
values = ImmutableList.of(variableValue);
}
Expand Down

0 comments on commit 5075f19

Please sign in to comment.