gnome-power-manager r3207 - in trunk: . src



Author: rhughes
Date: Sat Jan 31 09:37:25 2009
New Revision: 3207
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3207&view=rev

Log:
2009-01-31  Richard Hughes  <richard hughsie com>

* src/egg-array-float.c: (egg_array_float_remove_outliers):
Fix a crash in the statistics tool when we have no stats data.


Modified:
   trunk/ChangeLog
   trunk/src/egg-array-float.c

Modified: trunk/src/egg-array-float.c
==============================================================================
--- trunk/src/egg-array-float.c	(original)
+++ trunk/src/egg-array-float.c	Sat Jan 31 09:37:25 2009
@@ -317,8 +317,12 @@
 	EggArrayFloat *result;
 
 	g_return_val_if_fail (length % 2 == 1, NULL);
-
 	result = egg_array_float_new (data->len);
+
+	/* check for no data */
+	if (data->len == 0)
+		goto out;
+
 	half_length = (length - 1) / 2;
 
 	/* copy start and end of array */
@@ -365,7 +369,7 @@
 			g_array_index (result, gfloat, i) = average_not_inc;
 		}
 	}
-
+out:
 	return result;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]