summaryrefslogtreecommitdiff
path: root/bs4/formatter.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/formatter.py')
-rw-r--r--bs4/formatter.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bs4/formatter.py b/bs4/formatter.py
index 09d15e7..9a692ec 100644
--- a/bs4/formatter.py
+++ b/bs4/formatter.py
@@ -108,6 +108,8 @@ class Formatter(EntitySubstitution):
behavior consistent between Python 2 and Python 3, and preserves
backwards compatibility with older versions of Beautiful Soup.
"""
+ if tag.attrs is None:
+ return []
return sorted(tag.attrs.items())