mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 07:08:02 +02: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 (cherry picked from commit6a3bb90ad4)
This commit is contained in:
parent
591837d6f5
commit
52c886a6d7
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++)
|
for (i = 0; i < connections->len; i++)
|
||||||
connection_watch (nmc, connections->pdata[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);
|
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);
|
g_signal_connect (nmc->client, NM_CLIENT_CONNECTION_REMOVED, G_CALLBACK (connection_removed), nmc);
|
||||||
|
|
||||||
return NMC_RESULT_SUCCESS;
|
return NMC_RESULT_SUCCESS;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue