mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
libgimp: fix writing empty array GValues in gimp_value_to_gp_param()
When g_value_get_boxed() returns a NULL array, we would encode nonsense on the wire and run into warnings. Now we simply send a zero-length array.
This commit is contained in:
parent
2679d66ffb
commit
97bbd4773e
1 changed files with 9 additions and 6 deletions
|
@ -785,10 +785,10 @@ gimp_value_to_gp_param (const GValue *value,
|
|||
{
|
||||
GimpArray *array = g_value_get_boxed (value);
|
||||
|
||||
if (array)
|
||||
{
|
||||
param->param_type = GP_PARAM_TYPE_ARRAY;
|
||||
|
||||
if (array)
|
||||
{
|
||||
param->data.d_array.size = array->length;
|
||||
|
||||
if (full_copy)
|
||||
|
@ -799,6 +799,7 @@ gimp_value_to_gp_param (const GValue *value,
|
|||
}
|
||||
else
|
||||
{
|
||||
param->data.d_array.size = 0;
|
||||
param->data.d_array.data = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -806,10 +807,10 @@ gimp_value_to_gp_param (const GValue *value,
|
|||
{
|
||||
GimpStringArray *array = g_value_get_boxed (value);
|
||||
|
||||
if (array)
|
||||
{
|
||||
param->param_type = GP_PARAM_TYPE_STRING_ARRAY;
|
||||
|
||||
if (array)
|
||||
{
|
||||
param->data.d_string_array.size = array->length;
|
||||
|
||||
if (full_copy)
|
||||
|
@ -821,6 +822,7 @@ gimp_value_to_gp_param (const GValue *value,
|
|||
}
|
||||
else
|
||||
{
|
||||
param->data.d_string_array.size = 0,
|
||||
param->data.d_string_array.data = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -828,12 +830,12 @@ gimp_value_to_gp_param (const GValue *value,
|
|||
{
|
||||
GimpObjectArray *array = g_value_get_boxed (value);
|
||||
|
||||
param->param_type = GP_PARAM_TYPE_ID_ARRAY;
|
||||
|
||||
if (array)
|
||||
{
|
||||
gint i;
|
||||
|
||||
param->param_type = GP_PARAM_TYPE_ID_ARRAY;
|
||||
|
||||
if (full_copy)
|
||||
param->data.d_id_array.type_name =
|
||||
g_strdup (g_type_name (array->object_type));
|
||||
|
@ -871,6 +873,7 @@ gimp_value_to_gp_param (const GValue *value,
|
|||
}
|
||||
else
|
||||
{
|
||||
param->data.d_id_array.size = 0;
|
||||
param->data.d_id_array.data = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue