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 55b45df commit 5f8b345
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 @@ -3,6 +3,7 @@
## Unreleased

- Fixed cover image size inside table
- Fixed "Cannot read properties of undefined (reading 'bottomMost')" if table contains too few rows

## 0.2.8 - 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 @@ -25,6 +25,10 @@ TableProcessor.prototype.beginTable = function (writer) {
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 5f8b345

Please sign in to comment.