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

Null-Conditional cannot be mixed with indexers #529

Open
rezanid opened this issue Jan 2, 2024 · 1 comment
Open

Null-Conditional cannot be mixed with indexers #529

rezanid opened this issue Jan 2, 2024 · 1 comment
Labels

Comments

@rezanid
Copy link

rezanid commented Jan 2, 2024

I noticed that null-conditionals are supported, although I wasn't able to find anything in the docs. But, when combined with indexers they fails. For instance, given the following example.

{{~ for item in a?.b[0] ~}}
  Something
{{~ end ~}}

I receive the following error.

Scriban.Syntax.ScriptRuntimeException: '(1,20) : error : Object a?.b is null. Cannot access indexer: a?.b[0]'

Could it be I'm doing something wrong?

@xoofx
Copy link
Member

xoofx commented Jan 19, 2024

Could you post a small program that replicates this exactly so that I can copy paste it quickly and check what's going wrong? From the error above, it looks like it is b that doesn't have a value, not a, but I can't tell without looking at the whole code.

@xoofx xoofx added the question label Jan 19, 2024
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