Browse code

Don't decode missing URLs.

Fixes https://github.com/jrfonseca/xdot.py/issues/39

Jose Fonseca authored on 15/11/2016 15:59:43
Showing 1 changed files

... ...
@@ -487,7 +487,12 @@ class XDotParser(DotParser):
487 487
             if attr in attrs:
488 488
                 parser = XDotAttrParser(self, attrs[attr])
489 489
                 shapes.extend(parser.parse())
490
-        url = attrs.get('URL', None).decode('utf-8')
490
+        try:
491
+            url = attrs['URL']
492
+        except KeyError:
493
+            url = None
494
+        else:
495
+            url = url.decode('utf-8')
491 496
         node = elements.Node(id, x, y, w, h, shapes, url)
492 497
         self.node_by_name[id] = node
493 498
         if shapes: