From 1e1a7b4c48ec207b2068dfb0fb49f0327cab98e1 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 29 Jul 2023 10:09:09 +0100 Subject: [PATCH] more defensive --- rich/markdown.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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: