Skip to content

Commit

Permalink
Add length check on doc info (resolves #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdmonaco committed May 7, 2018
1 parent 3b4c7ef commit 1ac0cb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pdf-title-rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ def _get_metadata(self, h):
except PDFSyntaxError:
return {}
parser.set_document(doc)

if not hasattr(doc, 'info') or len(doc.info) == 0:
return {}
return doc.info[0]

def _get_xmp_metadata(self):
Expand Down

0 comments on commit 1ac0cb5

Please sign in to comment.