From 0b46d0852fa764f5a9cc5d7a71c279ed56c1401d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 1 Jun 2012 13:57:03 -0500 Subject: In indicator_power_device_get_time_details(), add a test for non-devices being passed in. --- src/device.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/device.c') diff --git a/src/device.c b/src/device.c index b163682..84af69c 100644 --- a/src/device.c +++ b/src/device.c @@ -515,6 +515,15 @@ indicator_power_device_get_time_details (const IndicatorPowerDevice * device, gchar ** details, gchar ** accessible_name) { + if (!INDICATOR_IS_POWER_DEVICE(device)) + { + *short_details = NULL; + *details = NULL; + *accessible_name = NULL; + g_warning ("%s: %p is not an IndicatorPowerDevice", G_STRFUNC, device); + return; + } + const time_t time = indicator_power_device_get_time (device); const UpDeviceState state = indicator_power_device_get_state (device); const gdouble percentage = indicator_power_device_get_percentage (device); -- cgit v1.2.3