diff --git a/src/svgutils/compose.py b/src/svgutils/compose.py index 8a30a3b..b99bda6 100644 --- a/src/svgutils/compose.py +++ b/src/svgutils/compose.py @@ -119,11 +119,11 @@ def __init__(self, fname=None, fix_mpl=False): super(SVG, self).__init__(svg.getroot().root) # if height/width is in % units, we can't store the absolute values - if svg.width.endswith("%"): + if svg.width is None or svg.width.endswith("%"): self._width = None else: self._width = Unit(svg.width).to("px") - if svg.height.endswith("%"): + if svg.height is None or svg.height.endswith("%"): self._height = None else: self._height = Unit(svg.height).to("px")