Browse code

Handle empy graph without crashing (issue 60).

Based on gcode@loowis.durge.org's feedback/patch.

José Fonseca authored on 05/08/2011 09:50:10
Showing 2 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+digraph mygraph {}
... ...
@@ -1122,8 +1122,8 @@ class XDotParser(DotParser):
1122 1122
             self.yscale = -1.0
1123 1123
             # FIXME: scale from points to pixels
1124 1124
 
1125
-            self.width = xmax - xmin
1126
-            self.height = ymax - ymin
1125
+            self.width  = max(xmax - xmin, 1)
1126
+            self.height = max(ymax - ymin, 1)
1127 1127
 
1128 1128
             self.top_graph = False
1129 1129