Skip to content

json.apply using null object before error thrown #10

@amillward

Description

@amillward

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;

}

Metadata

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