Skip to content

Commit

Permalink
Merge pull request #6 from szepeviktor/patch-1
Browse files Browse the repository at this point in the history
handle undefined href attribute
Fixes #5
  • Loading branch information
Alir3z4 committed May 26, 2014
2 parents 0fc7276 + cefe76c commit 3c4fe0e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions html2text.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,9 @@ def handle_tag(self, tag, attrs, start):
if tag == "a" and not self.ignore_links:
if start:
if ('href' in attrs) and \
not (self.skip_internal_links and
attrs['href'].startswith('#')):
(attrs['href'] is not None) and \
not (self.skip_internal_links and
attrs['href'].startswith('#')):
self.astack.append(attrs)
self.maybe_automatic_link = attrs['href']
else:
Expand Down

0 comments on commit 3c4fe0e

Please sign in to comment.