mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 00:10:07 +01:00
libnm-core: allow G_TYPE_STRV to be NULL
Otherwise we assert in _nm_utils_strv_to_slist() when setting a property,
using the code like:
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (param_spec));
g_param_value_set_default (param_spec, &value);
g_object_set_property (G_OBJECT (setting), prop, &value);
e.g:
nmcli con mod my_profile eth.mac-address-blacklist "02:14:20:e6:16:83"
(changed by commit 6a4127cfa0)
This commit is contained in:
parent
8657b4229c
commit
053c8fa5df
1 changed files with 4 additions and 3 deletions
|
|
@ -681,9 +681,7 @@ _nm_utils_strv_to_slist (char **strv)
|
|||
int i;
|
||||
GSList *list = NULL;
|
||||
|
||||
g_return_val_if_fail (strv != NULL, NULL);
|
||||
|
||||
for (i = 0; strv[i]; i++)
|
||||
for (i = 0; strv && strv[i]; i++)
|
||||
list = g_slist_prepend (list, g_strdup (strv[i]));
|
||||
|
||||
return g_slist_reverse (list);
|
||||
|
|
@ -696,6 +694,9 @@ _nm_utils_slist_to_strv (GSList *slist)
|
|||
char **strv;
|
||||
int len, i = 0;
|
||||
|
||||
if (slist == NULL)
|
||||
return NULL;
|
||||
|
||||
len = g_slist_length (slist);
|
||||
strv = g_new (char *, len + 1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue