mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 23:30:28 +01:00
libnm-core: return NULL from _nm_utils_slist_to_strv for empty lists
The function is used, among others, in the get_property() of many objects to return a boxed strv from a list. The default value for a boxed strv property is NULL, but _nm_utils_slist_to_strv() returns a pointer to an array with zero elements when the list is empty. Change the function to return NULL if the input list is empty.
This commit is contained in:
parent
f7875a42b0
commit
660bb1a48f
1 changed files with 2 additions and 0 deletions
|
|
@ -819,6 +819,8 @@ _nm_utils_slist_to_strv (GSList *slist, gboolean deep_copy)
|
|||
int len, i;
|
||||
|
||||
len = g_slist_length (slist);
|
||||
if (!len)
|
||||
return NULL;
|
||||
strv = g_new (char *, len + 1);
|
||||
|
||||
if (deep_copy) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue