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



Author: rhughes
Date: Mon Jun 23 10:06:27 2008
New Revision: 2825
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2825&view=rev

Log:
2008-06-23  Richard Hughes  <richard hughsie com>

* src/gpm-cell.c: (gpm_cell_get_id):
Don't segfault in gpm_cell_get_id() if we don't have a model or serial number.


Modified:
   trunk/ChangeLog
   trunk/src/gpm-cell.c

Modified: trunk/src/gpm-cell.c
==============================================================================
--- trunk/src/gpm-cell.c	(original)
+++ trunk/src/gpm-cell.c	Mon Jun 23 10:06:27 2008
@@ -467,7 +467,7 @@
 	string = g_string_new ("");
 
 	/* in an ideal world, model-capacity-serial */
-	if (strlen (cell->priv->model) > 2) {
+	if (cell->priv->model != NULL && strlen (cell->priv->model) > 2) {
 		g_string_append (string, cell->priv->model);
 		g_string_append_c (string, '-');
 	}
@@ -475,7 +475,7 @@
 		g_string_append_printf (string, "%i", cell->priv->unit.charge_design);
 		g_string_append_c (string, '-');
 	}
-	if (strlen (cell->priv->serial) > 2) {
+	if (cell->priv->serial != NULL && strlen (cell->priv->serial) > 2) {
 		g_string_append (string, cell->priv->serial);
 		g_string_append_c (string, '-');
 	}



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