Skip to content

Commit

Permalink
Avoid divide by zero when rendering I/O utilization
Browse files Browse the repository at this point in the history
It may happen to have it as max as 0
  • Loading branch information
xrmx committed Aug 22, 2010
1 parent a97cfb8 commit dbd7246
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pybootchartgui/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def transform_point_coords(point, x_base, y_base, \

max_x = max (x for (x, y) in data)
max_y = max (y for (x, y) in data)
# avoid divide by zero when we render I/O utilization and max is 0
if max_y == 0:
max_y = 1.0
xscale = float (chart_bounds[2]) / max_x
yscale = float (chart_bounds[3]) / max_y

Expand Down

0 comments on commit dbd7246

Please sign in to comment.