diff --git a/CHANGES b/CHANGES index a38eacb1f..5e484652b 100644 --- a/CHANGES +++ b/CHANGES @@ -27,6 +27,7 @@ Bugs fixed * #2394: Fix Sphinx crashes when html_last_updated_fmt is invalid * #2408: dummy builder not available in Makefile and make.bat * #2412: Fix hyperlink targets are broken in LaTeX builder +* Fix figure directive crashes if non paragraph item is given as caption Release 1.4 (released Mar 28, 2016) diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py index 7e00bc81c..dcdc41a17 100644 --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -19,10 +19,11 @@ class Figure(images.Figure): def run(self): name = self.options.pop('name', None) - (figure_node,) = images.Figure.run(self) - if isinstance(figure_node, nodes.system_message): - return [figure_node] + result = images.Figure.run(self) + if len(result) == 2 or isinstance(result[0], nodes.system_message): + return result + (figure_node,) = result if name: self.options['name'] = name self.add_name(figure_node)