Skip to content

Commit

Permalink
Merge pull request #215 from matclab/fix/214
Browse files Browse the repository at this point in the history
Check for None before dereferencing
  • Loading branch information
GuillaumeSeren authored Jan 2, 2019
2 parents 9488e7f + 787324d commit 9bc4da4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions afew/filters/DMARCReportInspectionFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ def read_auth_results(document):
root = ET.fromstring(document)
for record in root.findall('record'):
auth_results = record.find('auth_results')
dkim = auth_results.find('dkim').find('result')
spf = auth_results.find('spf').find('result')
results['dkim'] &= not has_failed(dkim)
results['spf'] &= not has_failed(spf)
if auth_results:
dkim = auth_results.find('dkim')
if dkim:
dkim = dkim.find('result')
results['dkim'] &= not has_failed(dkim)
spf = auth_results.find('spf')
if spf:
spf = spf.find('result')
results['spf'] &= not has_failed(spf)

return results

Expand Down

0 comments on commit 9bc4da4

Please sign in to comment.