summaryrefslogtreecommitdiff
path: root/src/nmcli/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nmcli/common.c')
-rw-r--r--src/nmcli/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nmcli/common.c b/src/nmcli/common.c
index e6c5c9a0b3..ff4c15c37e 100644
--- a/src/nmcli/common.c
+++ b/src/nmcli/common.c
@@ -539,8 +539,6 @@ nmc_find_active_connection(const GPtrArray *active_cons,
NMActiveConnection *candidate = g_ptr_array_index(active_cons, i);
const char *v, *v_num;
- con = nm_active_connection_get_connection(candidate);
-
/* When filter_type is NULL, compare connection ID (filter_val)
* against all types. Otherwise, only compare against the specific
* type. If 'path' or 'apath' filter types are specified, comparison
@@ -562,6 +560,8 @@ nmc_find_active_connection(const GPtrArray *active_cons,
goto found;
}
+ con = nm_active_connection_get_connection(candidate);
+
if (NM_IN_STRSET(filter_type, NULL, "path")) {
v = con ? nm_connection_get_path(NM_CONNECTION(con)) : NULL;
v_num = nm_utils_dbus_path_get_last_component(v);