diff --git a/CHANGES b/CHANGES index 5d3a7b809..23fc8cbd3 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,8 @@ Changes in trunk * sphinx.htmlwriter: Make parsed-literal blocks work as expected, not highlighting them via Pygments. +* sphinx.environment: Don't error out on reading an empty source file. + Release 0.1.61798 (Mar 23, 2008) ================================ diff --git a/sphinx/environment.py b/sphinx/environment.py index 44f015fe8..34590ddc0 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -457,7 +457,11 @@ class BuildEnvironment: Process the docinfo part of the doctree as metadata. """ self.metadata[docname] = md = {} - docinfo = doctree[0] + try: + docinfo = doctree[0] + except IndexError: + # probably an empty document + return if docinfo.__class__ is not nodes.docinfo: # nothing to see here return