cli: return NULL strv array from _ip_config_get_routes() if there are no routes

The property getter for certain properties tries to return
a strv array.

In this case, the result should be identical, whether an
empty strv array or NULL is returned.

Let _ip_config_get_routes() return %NULL if there are no routes.
This should have no practical difference, but it actually exposes
a bug in "cli/common/utils.c", which was previously hidden by
not commonly returning %NULL. This bug will be fixed in the
next commit.
This commit is contained in:
Thomas Haller
2018-06-08 08:21:07 +02:00
parent b29bf1b079
commit dba41ee1e1
41 changed files with 83 additions and 40 deletions

View File

@@ -49,6 +49,9 @@ _ip_config_get_routes (NMIPConfig *cfg)
if (!ptr_array)
return NULL;
if (ptr_array->len == 0)
return NULL;
arr = g_new (char *, ptr_array->len + 1);
for (i = 0; i < ptr_array->len; i++) {
NMIPRoute *route = g_ptr_array_index (ptr_array, i);