mirror of https://github.com/GNOME/gimp.git
app: gimp_container_get_name_array() should always return a GStrv.
Even if the container is empty, then we return a GStrv of length 1 (i.e.
an array of length 1, terminating with NULL).
In particular, it improves gimp_container_get_filtered_name_array() as
well, and in turn various list-returning functions in libgimp. This
makes the API more consistent after changes from commit 8eb7f6df9e
.
Note that a NULL return can be acceptable for error cases, but an empty
list because this is the expected result for the request should be an
empty GStrv, not NULL.
This commit is contained in:
parent
a6fab71a9a
commit
8c43e641e3
|
@ -1000,13 +1000,11 @@ gimp_container_get_name_array (GimpContainer *container)
|
|||
{
|
||||
gchar **names;
|
||||
gchar **iter;
|
||||
gint length;
|
||||
gint length;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
||||
|
||||
length = gimp_container_get_n_children (container);
|
||||
if (length == 0)
|
||||
return NULL;
|
||||
|
||||
names = iter = g_new0 (gchar *, length + 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue