Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loop.length is not of type Number #362

Closed
ChristianCiach opened this issue Jun 29, 2018 · 1 comment
Closed

loop.length is not of type Number #362

ChristianCiach opened this issue Jun 29, 2018 · 1 comment
Assignees
Milestone

Comments

@ChristianCiach
Copy link

ChristianCiach commented Jun 29, 2018

Since Pebble 2.5 I've updated from 2.4.0 to 2.6.1, I encounter this error:

Caused by: java.lang.RuntimeException: invalid operands for mathematical operation [SUBTRACT]
	at com.mitchellbosecke.pebble.utils.OperatorUtils.wideningConversionBinaryOperation(OperatorUtils.java:157)
	at com.mitchellbosecke.pebble.utils.OperatorUtils.subtract(OperatorUtils.java:56)
	at com.mitchellbosecke.pebble.node.expression.SubtractExpression.evaluate(SubtractExpression.java:21)

This is the statement inside the template:
{% if loop.index < ( loop.length - 1) %}

This worked before.

Using a debugger, I can see that "loop.length" is of type "ForNode$1" (whatever this may be), while "loop.index" is of type "Integer" (as expected).

@ebussieres
Copy link
Member

ebussieres commented Jun 30, 2018

Just made a fix and a release (2.6.2) for this. It's gonna be available in a few minutes in central repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants