Skip to content

Commit

Permalink
[fix] null values should merge properly instead of throwing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeck committed Sep 9, 2012
1 parent 7421836 commit da39d3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nconf/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ Provider.prototype._execute = function (action, syncLength /* [arguments] */) {
response = store[action].apply(store, args);

// Merge objects if necessary
if (action === 'get' && typeof response === 'object' && !Array.isArray(response)) {
if (response && action === 'get' && typeof response === 'object' && !Array.isArray(response)) {
mergeObjs.push(response);
response = undefined;
}
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

exports.data = {
isNull: null,
literal: 'bazz',
arr: ['one', 2, true, { value: 'foo' }],
obj: {
Expand Down

1 comment on commit da39d3c

@justgord
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for merging, and adding the test, your version also reads nicer :]

Please sign in to comment.