Skip to content

Commit

Permalink
fix for Cannot convert null to object at hasOwnProperty (native) when…
Browse files Browse the repository at this point in the history
… node is null
  • Loading branch information
Tully committed Dec 13, 2012
1 parent 09f560c commit d9f52fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Traverse.prototype.get = function (ps) {
var node = this.value;
for (var i = 0; i < ps.length; i ++) {
var key = ps[i];
if (!Object.hasOwnProperty.call(node, key)) {
if (node == null || !Object.hasOwnProperty.call(node, key)) {
node = undefined;
break;
}
Expand All @@ -23,7 +23,7 @@ Traverse.prototype.has = function (ps) {
var node = this.value;
for (var i = 0; i < ps.length; i ++) {
var key = ps[i];
if (!Object.hasOwnProperty.call(node, key)) {
if (node == null || !Object.hasOwnProperty.call(node, key)) {
return false;
}
node = node[key];
Expand Down

0 comments on commit d9f52fa

Please sign in to comment.