From 40ac0edc686b0ea52b8574ba112820d925c6d87b Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Mon, 13 Apr 2020 23:14:40 -0400 Subject: [PATCH] Verify Edge attributes exist before setting --- diagrams/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/diagrams/__init__.py b/diagrams/__init__.py index 9626ea6..e119a60 100644 --- a/diagrams/__init__.py +++ b/diagrams/__init__.py @@ -436,10 +436,13 @@ class Edge: for k, v in self._default_edge_attrs.items(): self._attrs[k] = v - # Graphviz complaining about using label for edges, so replace it with xlabel. - self._attrs["xlabel"] = label - self._attrs["color"] = color - self._attrs["style"] = style + if label: + # Graphviz complaining about using label for edges, so replace it with xlabel. + self._attrs["xlabel"] = label + if color: + self._attrs["color"] = color + if style: + self._attrs["style"] = style self._attrs.update(attrs) def __sub__(self, other: Union["Node", "Edge", List["Node"]]):