[Xfce4-commits] <xfce4-power-manager:devkit-power> Fix segfault when devkit-power isn't present.

Ali Abdallah noreply at xfce.org
Wed Nov 11 14:54:01 CET 2009


Updating branch refs/heads/devkit-power
         to 24a8c20db4e41eaca593512d57b36936155695cd (commit)
       from 4f6383677fc989431b893f5d7a28e1a45235de15 (commit)

commit 24a8c20db4e41eaca593512d57b36936155695cd
Author: Ali Abdallah <ali at ali-xfce.org>
Date:   Wed Nov 11 14:50:24 2009 +0100

    Fix segfault when devkit-power isn't present.

 src/xfpm-dkp.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/xfpm-dkp.c b/src/xfpm-dkp.c
index 507912f..6384b7c 100644
--- a/src/xfpm-dkp.c
+++ b/src/xfpm-dkp.c
@@ -1027,14 +1027,17 @@ xfpm_dkp_get_power_devices (XfpmDkp *dkp)
     
     array = xfpm_dkp_enumerate_devices (dkp);
     
-    for ( i = 0; i < array->len; i++)
+    if ( array )
     {
-	const gchar *object_path = ( const gchar *) g_ptr_array_index (array, i);
-	XFPM_DEBUG ("Power device detected at : %s", object_path);
-	xfpm_dkp_add_device (dkp, object_path);
+	for ( i = 0; i < array->len; i++)
+	{
+	    const gchar *object_path = ( const gchar *) g_ptr_array_index (array, i);
+	    XFPM_DEBUG ("Power device detected at : %s", object_path);
+	    xfpm_dkp_add_device (dkp, object_path);
+	}
+	g_ptr_array_free (array, TRUE);
     }
     
-    g_ptr_array_free (array, TRUE);
 }
 
 static void



More information about the Xfce4-commits mailing list