diff --git a/rich/markdown.py b/rich/markdown.py index 3ab4af0e..704da301 100644 --- a/rich/markdown.py +++ b/rich/markdown.py @@ -254,10 +254,9 @@ class TableElement(MarkdownElement): ) -> RenderResult: table = Table(box=box.SIMPLE_HEAVY) - assert self.header is not None - assert self.header.row is not None - for column in self.header.row.cells: - table.add_column(column.content) + if self.header is not None and self.header.row is not None: + for column in self.header.row.cells: + table.add_column(column.content) if self.body is not None: for row in self.body.rows: