aboutsummaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
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);