Guard against None returned for the top-level parent node

This commit is contained in:
Robin Dunn
2022-05-09 22:11:22 -07:00
parent d7711acce3
commit 9d19ba1ee7

View File

@@ -794,7 +794,9 @@ class Paragraph(Node):
section = Section(element, None, self.kind)
root = self.GetTopLevelParent()
root.AddSection(section)
# TODO: Why is there sometimes not a top-level parent node?
if root is not None:
root.AddSection(section)
else: