Skip to content

Commit

Permalink
Fixed "Cannot read properties of undefined (reading 'bottomMost')" if…
Browse files Browse the repository at this point in the history
… table contains too few rows #2549
  • Loading branch information
liborm85 committed Dec 30, 2023
1 parent 3cf4433 commit f514a11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Minimal supported version Node.js 16 LTS
- Fixed cover image size inside table
- Fixed "Cannot read properties of undefined (reading 'bottomMost')" if table contains too few rows

## 0.3.0-beta.6 - 2023-11-09

Expand Down
4 changes: 4 additions & 0 deletions src/TableProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class TableProcessor {
this.cleanUpRepeatables = false;

this.headerRows = tableNode.table.headerRows || 0;
if (this.headerRows > tableNode.table.body.length) {
throw new Error(`Too few rows in the table. Property headerRows requires at least ${this.headerRows}, contains only ${tableNode.table.body.length}`);
}

this.rowsWithoutPageBreak = this.headerRows + (tableNode.table.keepWithHeaderRows || 0);
this.dontBreakRows = tableNode.table.dontBreakRows || false;

Expand Down

0 comments on commit f514a11

Please sign in to comment.