mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 11:00:09 +01:00
cli: fix crash on autocompletion
@connections is NULL when doing autocompletion. Fixes the following:
$ nmcli --complete-args con monitor ""
help
id
uuid
path
filename
...
Segmentation fault (core dumped)
Fixes: 4b3297271e ('cli: rework connection handling for multiple results')
https://bugzilla.redhat.com/show_bug.cgi?id=1716948
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/177
This commit is contained in:
parent
32c6c0cdaf
commit
6a3bb90ad4
1 changed files with 3 additions and 2 deletions
|
|
@ -8741,6 +8741,9 @@ do_connection_monitor (NmCli *nmc, int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (nmc->complete)
|
||||
return nmc->return_value;
|
||||
|
||||
for (i = 0; i < connections->len; i++)
|
||||
connection_watch (nmc, connections->pdata[i]);
|
||||
|
||||
|
|
@ -8750,8 +8753,6 @@ do_connection_monitor (NmCli *nmc, int argc, char **argv)
|
|||
g_signal_connect (nmc->client, NM_CLIENT_CONNECTION_ADDED, G_CALLBACK (connection_added), nmc);
|
||||
}
|
||||
|
||||
if (nmc->complete)
|
||||
return nmc->return_value;
|
||||
g_signal_connect (nmc->client, NM_CLIENT_CONNECTION_REMOVED, G_CALLBACK (connection_removed), nmc);
|
||||
|
||||
return NMC_RESULT_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue