[GRASS-SVN] r49971 -
grass/branches/develbranch_6/display/d.vect.chart
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 30 07:00:12 EST 2011
Author: neteler
Date: 2011-12-30 04:00:11 -0800 (Fri, 30 Dec 2011)
New Revision: 49971
Modified:
grass/branches/develbranch_6/display/d.vect.chart/pie.c
Log:
avoid division by zero
Modified: grass/branches/develbranch_6/display/d.vect.chart/pie.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect.chart/pie.c 2011-12-30 11:59:54 UTC (rev 49970)
+++ grass/branches/develbranch_6/display/d.vect.chart/pie.c 2011-12-30 12:00:11 UTC (rev 49971)
@@ -33,7 +33,10 @@
ang = 0;
for (i = 0; i < ncols; i++) {
sum += val[i];
- end_ang = 2 * PI * sum / tot_sum;
+ if (tot_sum > 0.0)
+ end_ang = 2 * PI * sum / tot_sum;
+ else
+ end_ang = 0;
Vect_reset_line(Points);
if (val[0] != tot_sum) /* all in one slice, don't draw line to center */
More information about the grass-commit
mailing list