mergeWith: stack passed to customizer should always be defined (#4244)

Summary:
If the first values encountered in the `object` in mergeWith are not objects, `stack` is undefined when passed to the `customizer`. Once the first object-ish value is encountered, `stack` gets initialized, and all further calls to `customizer` include a defined `stack`. This PR makes `stack` always defined, even before the first object-ish value is encountered.
This commit is contained in:
Marc Hassan
2019-03-21 23:54:53 -04:00
committed by John-David Dalton
parent 7084300d34
commit 0b8592a35c
2 changed files with 12 additions and 9 deletions

View File

@@ -3588,8 +3588,8 @@
return;
}
baseFor(source, function(srcValue, key) {
stack || (stack = new Stack);
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {