bugfix in fn merge_tables

pull/5428/head
Milan Hauth 5 years ago
parent e76f37d8a8
commit b7d5974a51

@ -59,14 +59,16 @@ function merge_tables<T>(
): { table: T[]; new_idx: number[] } {
const table = original.slice();
const new_idx = [];
for (let j = 0; j < original.length; j++) {
const current = extended[j];
const existing = table.indexOf(current);
if (existing < 0) {
table.push(current);
new_idx[j] = table.length - 1;
} else {
new_idx[j] = existing;
if (extended) {
for (let j = 0; j < extended.length; j++) {
const current = extended[j];
const existing = table.indexOf(current);
if (existing == -1) {
table.push(current);
new_idx[j] = table.length - 1;
} else {
new_idx[j] = existing;
}
}
}
return { table, new_idx };

Loading…
Cancel
Save