aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar bensong@google.com <bensong@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-13 13:53:16 +0000
committerGravatar bensong@google.com <bensong@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-13 13:53:16 +0000
commit741b2e1cf144d3bbd368ade8865f15049d78d2ae (patch)
treed36fee597b251e630bf94223456eada1ee2bcad7 /bench
parent5f879755f4928cb8cc5f88daddaf0fc11b44d1bb (diff)
Fixes zero division when there are no lines to plot (only one revision in range)
(SkipBuildbotRuns) Review URL: https://codereview.chromium.org/16907003 git-svn-id: http://skia.googlecode.com/svn/trunk@9578 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench')
-rw-r--r--bench/bench_graph_svg.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bench/bench_graph_svg.py b/bench/bench_graph_svg.py
index 433ede4681..7d03a2aefe 100644
--- a/bench/bench_graph_svg.py
+++ b/bench/bench_graph_svg.py
@@ -809,7 +809,7 @@ def output_svg(lines, regressions, requested_width, requested_height):
(global_min_x, _), (global_max_x, global_max_y) = bounds(lines)
max_up_slope, min_down_slope = bounds_slope(regressions)
-
+
#output
global_min_y = 0
x = global_min_x
@@ -818,7 +818,11 @@ def output_svg(lines, regressions, requested_width, requested_height):
h = global_max_y - global_min_y
font_size = 16
line_width = 2
-
+
+ # If there is nothing to see, don't try to draw anything.
+ if w == 0 or h == 0:
+ return
+
pic_width, pic_height = compute_size(requested_width, requested_height
, w, h)