diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-04-16 13:25:16 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-04-16 13:25:16 +0100 |
commit | eea9fecdc168f7372b97cde462c0ade7cdbb17cc (patch) | |
tree | 070fdf860b2ce9cf15d57950e61df75f548ee4c9 /telepathy-glib/capabilities.c | |
parent | d98380c44ec079d858bbf66f0b298c78dca0d76f (diff) | |
download | telepathy-glib-eea9fecdc168f7372b97cde462c0ade7cdbb17cc.tar.gz |
TpCapabilities: cope gracefully with being constructed with classes=NULL
Diffstat (limited to 'telepathy-glib/capabilities.c')
-rw-r--r-- | telepathy-glib/capabilities.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/telepathy-glib/capabilities.c b/telepathy-glib/capabilities.c index 60ad7fdab..a360344dc 100644 --- a/telepathy-glib/capabilities.c +++ b/telepathy-glib/capabilities.c @@ -242,14 +242,29 @@ tp_capabilities_init (TpCapabilities *self) TpCapabilitiesPrivate); } +/* NULL-safe for @classes */ TpCapabilities * _tp_capabilities_new (const GPtrArray *classes, gboolean contact_specific) { - return g_object_new (TP_TYPE_CAPABILITIES, + GPtrArray *empty = NULL; + TpCapabilities *self; + + if (classes == NULL) + { + empty = g_ptr_array_sized_new (0); + classes = empty; + } + + self = g_object_new (TP_TYPE_CAPABILITIES, "channel-classes", classes, "contact-specific", contact_specific, NULL); + + if (empty != NULL) + g_ptr_array_free (empty, TRUE); + + return self; } static gboolean |