cli: fix offline mode for parsing "connection.secondaries"

$ nmcli --offline connection add type ethernet con-name x connection.secondaries foo

  (process:48855): nm-CRITICAL **: 09:16:03.051: nm_client_get_connections: assertion 'NM_IS_CLIENT(client)' failed
  **
  nm:ERROR:src/nmcli/common.c:437:nmc_find_connection: assertion failed: (connections)
  Bail out! nm:ERROR:src/nmcli/common.c:437:nmc_find_connection: assertion failed: (connections)
  Aborted (core dumped)
This commit is contained in:
Thomas Haller
2023-05-22 09:16:10 +02:00
parent 1b26315a1f
commit 30a6742d96

View File

@@ -366,6 +366,9 @@ _set_fcn_precheck_connection_secondaries(NMClient *client,
if (!strv0) if (!strv0)
return TRUE; return TRUE;
if (!client)
return TRUE;
connections = nm_client_get_connections(client); connections = nm_client_get_connections(client);
strv = g_strdupv((char **) strv0); strv = g_strdupv((char **) strv0);