Skip to content

Commit

Permalink
Updated Memory.merge to handle null values
Browse files Browse the repository at this point in the history
Previously, if the Memory store was merged with an object containing a null value, the following Error occurred:

TypeError: Object.keys called on non-object
    at Function.keys (native)
    at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:199:17)
    at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:200:17)
    at Array.every (native)
    at Memory.merge (/.../node_modules/nconf/lib/nconf/stores/memory.js:199:29)
    at common.merge (/.../node_modules/nconf/lib/nconf/common.js:99:13)
    at Array.forEach (native)
    at common.merge (/.../node_modules/nconf/lib/nconf/common.js:98:22)
    at Array.forEach (native)
    at Object.common.merge (/.../node_modules/nconf/lib/nconf/common.js:97:8)

This commit prevents that.
  • Loading branch information
SchoonologyRRL committed Sep 27, 2012
1 parent 2ba4378 commit ed41c51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nconf/stores/memory.js
Expand Up @@ -157,7 +157,7 @@ Memory.prototype.merge = function (key, value) {
// If the key is not an `Object` or is an `Array`,
// then simply set it. Merging is for Objects.
//
if (typeof value !== 'object' || Array.isArray(value)) {
if (typeof value !== 'object' || Array.isArray(value) || value === null) {
return this.set(key, value);
}

Expand Down

0 comments on commit ed41c51

Please sign in to comment.