diff options
author | Leonard Richardson <leonardr@segfault.org> | 2015-09-28 19:17:10 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2015-09-28 19:17:10 -0400 |
commit | 3b82b2ba6d7b1cc98bcca6ffe5970e5d90198351 (patch) | |
tree | 8481a7dcddd234b7c40108ebeb3194c580d014aa /bs4/element.py | |
parent | 0d5e476b466abb48766c48693d7b37ce570d9d1b (diff) |
Don't allow inserting None into a tag.
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py index c70ad5a..336768b 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -294,6 +294,8 @@ class PageElement(object): _lastRecursiveChild = _last_descendant def insert(self, position, new_child): + if new_child is None: + raise ValueError("Cannot insert None into a tag.") if new_child is self: raise ValueError("Cannot insert a tag into itself.") if (isinstance(new_child, basestring) |