From e2431a9ab55122b74397b4536ea95f769bc64999 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 19 Jun 2013 10:01:19 -0500 Subject: in indicator_power_device_provider_get_devices, confirm that the get_devices function pointer isn't NULL before we call it. --- src/device-provider.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/device-provider.c') 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; } /** -- cgit v1.2.3