Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Prevent call of Config.prototype._diffDeep with an undefined argument #43

Merged
merged 1 commit into from

2 participants

@hugo-agbonon

Config.prototype._diffDeep crashes if called with a value of undefined for the object1 parameter, but the recursive calls of the method could make it happen.

Example code which would have caused a crash :
var obj1 = {a: {}};
var obj2 = {a: {b: {c: 'd'}}};
t._diffDeep(obj1, obj2);

@hugo-agbonon hugo-agbonon Fix error in _diffDeep
Prevent method from being called with an undefined value for object1.
2acce75
@lorenwest lorenwest merged commit 0eff980 into from
@lorenwest
Owner

Looks good - thanks for the catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 6, 2013
  1. @hugo-agbonon

    Fix error in _diffDeep

    hugo-agbonon authored
    Prevent method from being called with an undefined value for object1.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/config.js
View
2  lib/config.js
@@ -917,7 +917,7 @@ Config.prototype._diffDeep = function(object1, object2, depth) {
for (var parm in object2) {
var value1 = object1[parm];
var value2 = object2[parm];
- if (value2 && typeof(value2) == 'object') {
+ if (value1 && value2 && typeof(value2) == 'object') {
if (!(t._equalsDeep(value1, value2))) {
diff[parm] = t._diffDeep(value1, value2, depth - 1);
}
Something went wrong with that request. Please try again.