From bae6018698fe6d16d8f9e4c32f413125d237304d Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Sun, 10 Aug 2008 08:46:09 +0100 Subject: don't try to access klass->get_stats() if it's not set --- src/dkp-device.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/dkp-device.c b/src/dkp-device.c index a76829e..809aa48 100644 --- a/src/dkp-device.c +++ b/src/dkp-device.c @@ -291,6 +291,13 @@ dkp_device_get_statistics (DkpDevice *device, const gchar *type, guint timespan, GValue *value; guint i; + /* doesn't even try to support this */ + if (klass->get_stats == NULL) { + error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "device does not support getting stats"); + dbus_g_method_return_error (context, error); + goto out; + } + array = klass->get_stats (device, type, timespan); /* maybe the device doesn't support histories */ if (array == NULL) { -- cgit v1.2.3