aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-19 10:01:19 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-06-19 10:01:19 -0500
commite2431a9ab55122b74397b4536ea95f769bc64999 (patch)
tree3c142ea5e6efe9af5c7916a419d2374d0e1e698d
parent0ec4365a419db7d7b19e4bd415645ada50a5e5fc (diff)
downloadayatana-indicator-power-e2431a9ab55122b74397b4536ea95f769bc64999.tar.gz
ayatana-indicator-power-e2431a9ab55122b74397b4536ea95f769bc64999.tar.bz2
ayatana-indicator-power-e2431a9ab55122b74397b4536ea95f769bc64999.zip
in indicator_power_device_provider_get_devices, confirm that the get_devices function pointer isn't NULL before we call it.
-rw-r--r--src/device-provider.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/device-provider.c b/src/device-provider.c
index 05c6cd0..5ccf588 100644
--- a/src/device-provider.c
+++ b/src/device-provider.c
@@ -62,9 +62,18 @@ indicator_power_device_provider_default_init (IndicatorPowerDeviceProviderInterf
GList *
indicator_power_device_provider_get_devices (IndicatorPowerDeviceProvider * self)
{
+ GList * devices;
+ IndicatorPowerDeviceProviderInterface * iface;
+
g_return_val_if_fail (INDICATOR_IS_POWER_DEVICE_PROVIDER (self), NULL);
+ iface = INDICATOR_POWER_DEVICE_PROVIDER_GET_INTERFACE (self);
+
+ if (iface->get_devices != NULL)
+ devices = iface->get_devices (self);
+ else
+ devices = NULL;
- return INDICATOR_POWER_DEVICE_PROVIDER_GET_INTERFACE (self)->get_devices (self);
+ return devices;
}
/**