Skip to content

Commit

Permalink
Fixed another crash in table rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Nov 14, 2023
1 parent 03924c1 commit cda338b
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -877,18 +877,26 @@ private fun EagerComposer.tableColFirst(
) {
val rowCount by remember {
derivedStateOf {
element.descendants("tr").count()
try {
element.descendants("tr").count()
} catch (t: Throwable) {
0
}
}
}
val colCount by remember {
derivedStateOf {
element.descendants("tr")
.map { row ->
row.descendants()
.filter {
it.tagName() in setOf("th", "td")
}.count()
}.maxOrNull() ?: 0
try {
element.descendants("tr")
.map { row ->
row.descendants()
.filter {
it.tagName() in setOf("th", "td")
}.count()
}.maxOrNull() ?: 0
} catch (t: Throwable) {
0
}
}
}

Expand Down

0 comments on commit cda338b

Please sign in to comment.