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

com.github.jknack.handlebars.helper.LookupHelper NullPointerException #1060

Open
jchobantonov-runbuggy opened this issue Mar 6, 2023 · 0 comments

Comments

@jchobantonov-runbuggy
Copy link

If you have:

lookup obj person.id

where we want to lookup into obj based on person.id as a key a NullPointerException could happen from lookup function:

java.lang.NullPointerException
inline@3a250195:271:21
at com.github.jknack.handlebars.helper.LookupHelper.apply(LookupHelper.java:60)

This line:

Object lookup = ctx.get(options.param(0).toString());

is the issue where options.param(0) could be null

since we already check for this:

    if (options.params.length <= 0) {
      return context;
    }

in order to not throw exception I think following should be added as well:

    if (options.params.length <= 0 || options.param(0) == null) {
      return context;
    }

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

1 participant