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

Index out of bounds should throw #72

Closed
tkrajacic opened this issue Oct 13, 2016 · 1 comment
Closed

Index out of bounds should throw #72

tkrajacic opened this issue Oct 13, 2016 · 1 comment
Labels

Comments

@tkrajacic
Copy link

When a template contains an invalid index (e.g. elements.1 where elements only has 1 element) Stencil crashes with a fatal error.

In my opinion it would be better to throw if the index is out of bounds as the template is a user-written document and the assumption that a subscript index is correct doesn't hold.

I had a look through the code but couldn't figure out right away where this happens.
For variables I found one instance where the index wasn't checked, but not for context lookup for arrays:

current = array[index]

@tkrajacic tkrajacic changed the title index out of bounds should throw Index out of bounds should throw Oct 13, 2016
@kylef kylef added the bug label Oct 13, 2016
@kylef
Copy link
Collaborator

kylef commented Oct 13, 2016

I agree @tkrajacic, fixed in 1e3afc0

@kylef kylef closed this as completed Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants