Fix issue with looping in list merging

The last_dest_idx variable should always have been
tracking the last index in the source list. The
original intention, implemented incorrectly, was
to just append any items which source has no item
at that index.
This commit is contained in:
Tom Byers
2021-01-26 12:16:08 +00:00
parent 1059cf4d81
commit 67392e97ee
2 changed files with 4 additions and 2 deletions

View File

@@ -651,9 +651,9 @@ def merge_jsonlike(source, destination):
return True
def merge_lists(source, destination):
last_dest_idx = len(destination) - 1
last_src_idx = len(source) - 1
for idx, item in enumerate(destination):
if idx <= last_dest_idx:
if idx <= last_src_idx:
# assign destination value if can't be merged into source
if merge_items(source[idx], destination[idx]) is False:
source[idx] = destination[idx]