Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: bench/bench_graph_svg.py

Issue 16907003: Fixes zero division when there are no lines to plot (only one revision in range) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/bench_graph_svg.py
===================================================================
--- bench/bench_graph_svg.py (revision 9529)
+++ bench/bench_graph_svg.py (working copy)
@@ -809,7 +809,7 @@
(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 @@
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698