Skip to content

Commit

Permalink
rifle: catch exceptions from etree.parse()
Browse files Browse the repository at this point in the history
diffprof would report a spurious error and hang if rifle was called on
an empty XML document.
  • Loading branch information
msmark authored and jrha committed May 29, 2018
1 parent 5654352 commit fb54336
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/bin/rifle.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,11 @@ def main(args=sys.argv, outfile=sys.stdout, xdup=None, xout=None):

from lxml import etree

tree = etree.parse(fname)
try:
tree = etree.parse(fname)
except Exception as err:
print "%s: %s: %s" % (CALL, str(err), fname)
return 1

if len(args) == 0:
root = tree.getroot()
Expand Down

0 comments on commit fb54336

Please sign in to comment.