From 51150f834c30ec90010bd6661ace098cb9383723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 13 Nov 2023 09:46:04 +0100 Subject: [PATCH] Added return in case rowLength == columns.size == 0 to prevent numberOfRows increment without data --- libs/execution/src/lib/types/io-types/table.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/execution/src/lib/types/io-types/table.ts b/libs/execution/src/lib/types/io-types/table.ts index baf6bacee..b3a409705 100644 --- a/libs/execution/src/lib/types/io-types/table.ts +++ b/libs/execution/src/lib/types/io-types/table.ts @@ -44,12 +44,20 @@ export class Table implements IOTypeImplementation { this.columns.set(name, column); } + /** + * Tries to add a new row to this table. + * NOTE: This method will only add the row if the table has at least one column! + * @param row data of this row for each column + */ addRow(row: TableRow): void { const rowLength = Object.keys(row).length; assert( rowLength === this.columns.size, `Added row has the wrong dimension (expected: ${this.columns.size}, actual: ${rowLength})`, ); + if (rowLength === 0) { + return; + } assert( Object.keys(row).every((x) => this.hasColumn(x)), 'Added row does not fit the columns in the table',