From ce8268447f48ba8d8bff99d8ac402be7bb9c01d5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 25 May 2012 15:31:16 -0500 Subject: indicator_power_set_devices() should fail gracefully when no devices are available --- src/indicator-power.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index c2ace80..59f884a 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -747,6 +747,9 @@ put_primary_device (IndicatorPower *self, IndicatorPowerDevice *device) const UpDeviceState state = indicator_power_device_get_state (device); const gchar * device_icon = indicator_power_device_get_icon (device); const gdouble percentage = indicator_power_device_get_percentage (device); + +g_message ("new primary device: %s", indicator_power_device_get_object_path(device)); + /* set icon */ device_gicons = get_device_icon (kind, state, time, device_icon); gtk_image_set_from_gicon (priv->status_image, @@ -807,9 +810,9 @@ get_devices_cb (GObject * source_object, gpointer user_data) { GError *error; - int device_count; - IndicatorPowerDevice ** devices; + int device_count = 0; GVariant * devices_container; + IndicatorPowerDevice ** devices = NULL; IndicatorPower *self = INDICATOR_POWER (user_data); /* build an array of IndicatorPowerDevices from the DBus response */ -- cgit v1.2.3