Skip to content

Commit

Permalink
Allow the value itself to perform equality checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
axiak committed Jan 26, 2015
1 parent 29a7773 commit a1177fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/com/floreysoft/jmte/token/IfCmpToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public String getText() {
@Override
public Object evaluate(TemplateContext context) {
final Object value = evaluatePlain(context);
final boolean condition = getOperand().equals(value.toString());
Object operand = getOperand();
final boolean condition = operand.equals(value.toString()) ||
(value != null && value.equals(operand));
final Object evaluated = negated ? !condition : condition;
return evaluated;
}
Expand Down

0 comments on commit a1177fd

Please sign in to comment.