aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-06 15:19:26 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-06 15:19:26 -0500
commit73bef489d16b6be22435247e23bf1ed80f4e99f1 (patch)
treebc781236cd6a8fa319457487d25c2e83b13b6df3 /src
parent50fb08d451719f049daa53d4a9649223a980e87b (diff)
downloadayatana-indicator-power-73bef489d16b6be22435247e23bf1ed80f4e99f1.tar.gz
ayatana-indicator-power-73bef489d16b6be22435247e23bf1ed80f4e99f1.tar.bz2
ayatana-indicator-power-73bef489d16b6be22435247e23bf1ed80f4e99f1.zip
In indicator_power_device_new_from_variant(), check whether the input variant has the correct type before using it.
Diffstat (limited to 'src')
-rw-r--r--src/device.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c
index 1c818cc..ce24520 100644
--- a/src/device.c
+++ b/src/device.c
@@ -640,6 +640,10 @@ indicator_power_device_new (const gchar * object_path,
IndicatorPowerDevice *
indicator_power_device_new_from_variant (GVariant * v)
{
+ g_return_val_if_fail (v != NULL, NULL);
+ g_return_val_if_fail (g_variant_type_is_tuple(g_variant_get_type(v)), NULL);
+ g_return_val_if_fail (g_variant_n_children(v) == 6, NULL);
+
UpDeviceKind kind = UP_DEVICE_KIND_UNKNOWN;
UpDeviceState state = UP_DEVICE_STATE_UNKNOWN;
const gchar * icon = NULL;