Skip to content
Browse files

Some errors don't have line or column, return None

re.search() can return None, if it does don't try to return not existant
restults
  • Loading branch information...
1 parent e0423e9 commit e0084795173f195ef886748b00046e0609769f2c @coledarr coledarr committed
Showing with 5 additions and 2 deletions.
  1. +5 −2 xpath/xpath.py
View
7 xpath/xpath.py 100644 → 100755
@@ -439,8 +439,11 @@ def set_error_position(self, error):
def first_group_match(self, pattern, text):
search = re.search(pattern, text)
- groups = search.groups()
- return groups[0]
+ if search is not None:
+ groups = search.groups()
+ return groups[0]
+ else:
+ return None
class XPathSearchErrorResult(XPathErrorResult):
def __init__(self, error, xpath):

0 comments on commit e008479

Please sign in to comment.
Something went wrong with that request. Please try again.