Skip to content

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

Closed

Description

@jchobantonov-runbuggy

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;
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions