summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 60464b6..02fd1b7 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)