fix(addressbook): Fix exception when using multiple address book source and searching. Fixes #5906.

This commit is contained in:
smizrahi
2023-12-12 12:08:25 +01:00
parent 3cd860838c
commit f85c53190c
2 changed files with 41 additions and 39 deletions
@@ -564,7 +564,7 @@
// Respect the order of the results
_.forEach(results, function(cardId, index) {
var oldIndex, removedCards;
if (cards[index].id != cardId) {
if (!_.isUndefined(cards[index]) && cards[index].id != cardId) {
oldIndex = _.findIndex(cards, _.bind(compareIds, cardId));
removedCards = cards.splice(oldIndex, 1);
cards.splice(index, 0, removedCards[0]);