Skip to content

Commit

Permalink
Avoid crashes when no URL is given
Browse files Browse the repository at this point in the history
Related to #231.
  • Loading branch information
liZe committed Feb 7, 2019
1 parent 23a4b95 commit 39127ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cairosvg/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,10 @@ def __init__(self, **kwargs):
else:
raise TypeError(
'No input. Use one of bytestring, file_obj or url.')
if parent and (
self.url == parent.url or
(url.startswith('#') and not self.url)):
self_is_parent = (
(parent and self.url == parent.url) or
(url and url.startswith('#') and not self.url))
if self_is_parent:
root_parent = parent
while root_parent.parent:
root_parent = root_parent.parent
Expand Down

0 comments on commit 39127ce

Please sign in to comment.