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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user