Don't error out on reading an empty file.

This commit is contained in:
Georg Brandl 2008-03-24 09:42:28 +00:00
parent a9c0a10b78
commit 93d39ac065
2 changed files with 7 additions and 1 deletions

View File

@ -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)
================================

View File

@ -457,7 +457,11 @@ class BuildEnvironment:
Process the docinfo part of the doctree as metadata.
"""
self.metadata[docname] = md = {}
try:
docinfo = doctree[0]
except IndexError:
# probably an empty document
return
if docinfo.__class__ is not nodes.docinfo:
# nothing to see here
return