Commit bcb9f6c9 authored by Thomas Haller's avatar Thomas Haller

cli: fix error parsing input arguments in non-interactive mode

Causes the following failure:

   $ /bin/nmcli connection add type ethernet con-name connie ifname '*'

   (process:13883): GLib-CRITICAL **: g_strchug: assertion `string != NULL' failed
   (process:13883): GLib-CRITICAL **: g_strchomp: assertion `string != NULL' failed
   Error: invalid connection type; '' not among [generic, ...].

Regression introduced by commit bfb1200b.
Signed-off-by: Thomas Haller's avatarThomas Haller <>
parent 5fa1248a
......@@ -4798,7 +4798,8 @@ cleanup_bridge_slave:
_("Error: 'vpn-type' is required."));
goto cleanup_vpn;
vpn_type = g_strstrip (vpn_type_ask);
if (vpn_type_ask)
vpn_type = g_strstrip (vpn_type_ask);
if (!(st = nmc_string_is_valid (vpn_type, nmc_known_vpns, NULL))) {
printf (_("Warning: 'vpn-type': %s not known.\n"), vpn_type);
......@@ -5218,7 +5219,8 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto error;
type = g_strstrip (type_ask);
if (type_ask)
type = g_strstrip (type_ask);
if (!(setting_name = check_valid_name (type, nmc_valid_connection_types, &error))) {
g_string_printf (nmc->return_text, _("Error: invalid connection type; %s."),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment