diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2013-11-19 16:16:33 -0500 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-01-14 11:15:29 +0000 |
commit | e0edaf682056f487b315c3d8236a06ac8c156b8d (patch) | |
tree | 6bc875725d45edc4968ab776461deeacdff6385e | |
parent | 2b1b3c4f6c271a64f6767c2cbd9f5713d0bdedaf (diff) | |
download | dbus-glib-e0edaf682056f487b315c3d8236a06ac8c156b8d.tar.gz |
dbus_g_value_build_g_variant(): Fix NULL strv case
g_variant_new_strv(NULL, -1) is not accepted, but (NULL, 0) is good.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71811
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | dbus/dbus-gtype-specialized.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dbus/dbus-gtype-specialized.c b/dbus/dbus-gtype-specialized.c index bb1faf4..6d87b84 100644 --- a/dbus/dbus-gtype-specialized.c +++ b/dbus/dbus-gtype-specialized.c @@ -1696,7 +1696,10 @@ dbus_g_value_build_g_variant (const GValue *value) else if (type == G_TYPE_STRING) return g_variant_new_string (g_value_get_string (value)); else if (type == G_TYPE_STRV) - return g_variant_new_strv (g_value_get_boxed (value), -1); + { + const gchar * const *strv = g_value_get_boxed (value); + return g_variant_new_strv (strv, (strv != NULL) ? -1 : 0); + } else if (type == DBUS_TYPE_G_OBJECT_PATH) return g_variant_new_object_path (g_value_get_boxed (value)); else if (type == DBUS_TYPE_G_SIGNATURE) |