mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 07:40:12 +01:00
cli: fix returning no results in complete function
For consistency, never return an empty array @values. If we have an empty array, instead return NULL. Also fixes commitafac7621a"clients: return NULL array on auto-completion failure", which claims that readline crashes with empty strv arrays. Fixes:afac7621ae
This commit is contained in:
parent
870f493853
commit
8efeb3688c
1 changed files with 10 additions and 2 deletions
|
|
@ -283,10 +283,18 @@ nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info,
|
|||
|
||||
nm_assert (!*out_to_free || values == (const char *const*) *out_to_free);
|
||||
|
||||
if (!text || !text[0] || !values || !values[0])
|
||||
if (!values)
|
||||
return NULL;
|
||||
|
||||
if (!values[0]) {
|
||||
nm_clear_g_free (out_to_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!text || !text[0])
|
||||
return values;
|
||||
|
||||
/* for convenience, we all the complete_fcn() implementations to
|
||||
/* for convenience, we allow the complete_fcn() implementations to
|
||||
* ignore "text". We filter out invalid matches here. */
|
||||
|
||||
text_len = strlen (text);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue