Skip to content

Commit

Permalink
Ensure the "else" part of a #list is evaluated in `Environment.visi…
Browse files Browse the repository at this point in the history
…t()`.
  • Loading branch information
nolaviz committed Feb 2, 2023
1 parent 0d80363 commit 2713f7a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/freemarker/core/ListElseContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public ListElseContainer(IteratorBlock listPart, ElseOfList elsePart) {

@Override
TemplateElement[] accept(Environment env) throws TemplateException, IOException {
if (!listPart.acceptWithResult(env)) {
return elsePart.accept(env);
if (listPart.acceptWithResult(env)) {
return null;
}
return null;
return new TemplateElement[] { elsePart };
}

@Override
Expand Down

0 comments on commit 2713f7a

Please sign in to comment.