Skip to content

json.apply using null object before error thrown #10

Open
@amillward

Description

From json.apply:

for (var j = 0; j < c.p.length; j++) {
  var p = c.p[j];
  parent = elem;
  parentKey = key;
  elem = elem[key];
  key = p;
  if (parent == null)
    throw new Error('Path invalid');
}

If parent is null, this code will break on elem = elem[key];. It should be:

for (var j = 0; j < c.p.length; j++) {
  var p = c.p[j];
  parent = elem;
  if (parent == null)
    throw new Error('Path invalid');
  parentKey = key;
  elem = elem[key];
  key = p;

}

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions