mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Reindex 'key_indicies' after item delete
The "keys.splice(i, 1)" removes one item at the specified position from an array. Thus hashes which are stored at "that._key_indicies" are no longer valid and should be reindexed. Fixes: https://pagure.io/freeipa/issue/7678 Reviewed-By: Serhii Tsymbaliuk <stsymbal@redhat.com>
This commit is contained in:
parent
c3f23da49d
commit
0dcce426a4
@ -112,6 +112,11 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function(map) {
|
|||||||
that.keys.splice(i, 1);
|
that.keys.splice(i, 1);
|
||||||
that.values.splice(i, 1);
|
that.values.splice(i, 1);
|
||||||
delete that._key_indicies[key];
|
delete that._key_indicies[key];
|
||||||
|
|
||||||
|
// reindex
|
||||||
|
for (var j=i; j<that.keys.length; j++) {
|
||||||
|
that._key_indicies[that.keys[j]]=j;
|
||||||
|
}
|
||||||
that.length = that.keys.length;
|
that.length = that.keys.length;
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user