Skip to content

Commit a723f70

Browse files
author
James Halliday
committed
guard the reference
1 parent 7da89fd commit a723f70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ module.exports = function (obj, opts) {
4040
}
4141
else seen.push(node);
4242

43-
if (node.toJSON && typeof node.toJSON === 'function') {
44-
node = node.toJSON();
45-
}
43+
if (node && node.toJSON && typeof node.toJSON === 'function') {
44+
node = node.toJSON();
45+
}
4646
var keys = objectKeys(node).sort(cmp && cmp(node));
4747
var out = [];
4848
for (var i = 0; i < keys.length; i++) {

0 commit comments

Comments
 (0)