From b3ed6085622c094c50dabcb428aeb6db220579d2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 28 Mar 2011 17:25:25 +0100 Subject: [PATCH 16/25] marshal_collection_array: fail early if the array is NULL --- dbus/dbus-gvalue.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dbus/dbus-gvalue.c b/dbus/dbus-gvalue.c index 13038a2..94a2eed 100644 --- a/dbus/dbus-gvalue.c +++ b/dbus/dbus-gvalue.c @@ -1945,6 +1945,9 @@ marshal_collection_array (DBusMessageIter *iter, guint elt_size; char *subsignature_str; + array = g_value_get_boxed (value); + g_return_val_if_fail (array != NULL, FALSE); + elt_gtype = dbus_g_type_get_collection_specialization (G_VALUE_TYPE (value)); g_assert (_dbus_g_type_is_fixed (elt_gtype)); subsignature_str = _dbus_gtype_to_signature (elt_gtype); @@ -1956,8 +1959,6 @@ marshal_collection_array (DBusMessageIter *iter, elt_size = _dbus_g_type_fixed_get_size (elt_gtype); - array = g_value_get_boxed (value); - if (!dbus_message_iter_open_container (iter, DBUS_TYPE_ARRAY, subsignature_str, @@ -1968,7 +1969,7 @@ marshal_collection_array (DBusMessageIter *iter, * is this always true? If it is we can probably avoid * a lot of the overhead in _marshal_basic_instance... */ - if (!array || !dbus_message_iter_append_fixed_array (&subiter, + if (!dbus_message_iter_append_fixed_array (&subiter, subsignature_str[0], &(array->data), array->len)) -- 1.7.4.1