aboutsummaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-01 13:57:03 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-01 13:57:03 -0500
commit0b46d0852fa764f5a9cc5d7a71c279ed56c1401d (patch)
tree188f9004badf2c679173e0b5ba8aca247851e9a1 /src/device.c
parent5b17593fb388ab9febc2e4bc26d8054a34dd58c0 (diff)
downloadayatana-indicator-power-0b46d0852fa764f5a9cc5d7a71c279ed56c1401d.tar.gz
ayatana-indicator-power-0b46d0852fa764f5a9cc5d7a71c279ed56c1401d.tar.bz2
ayatana-indicator-power-0b46d0852fa764f5a9cc5d7a71c279ed56c1401d.zip
In indicator_power_device_get_time_details(), add a test for non-devices being passed in.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c9
1 files changed, 9 insertions, 0 deletions
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);