diff options
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py index 67f2a79..2834fcb 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -638,6 +638,9 @@ class PageElement(object): tag, id = token.split('#', 1) if tag == "": tag = True + if len(current_context) == 0: + # No match. + return [] el = current_context[0].find(tag, {'id': id}) if el is None: return [] # No match |