Merge pull request #2261 from mitya57/stable

transforms: Don't try to call has_child on parent nodes that are None
This commit is contained in:
Georg Brandl 2016-01-22 19:41:11 +01:00
commit f2d264febe

View File

@ -121,13 +121,13 @@ class AutoNumbering(Transform):
if has_child(node, nodes.caption):
self.document.note_implicit_target(node)
elif isinstance(node, nodes.image):
if has_child(node.parent, nodes.caption):
if node.parent and has_child(node.parent, nodes.caption):
self.document.note_implicit_target(node.parent)
elif isinstance(node, nodes.table):
if has_child(node, nodes.title):
self.document.note_implicit_target(node)
elif isinstance(node, nodes.literal_block):
if has_child(node.parent, nodes.caption):
if node.parent and has_child(node.parent, nodes.caption):
self.document.note_implicit_target(node.parent)