From d3d1cd2b3eeee3ff2959cc0eb07d720263db6464 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 29 Jul 2022 00:03:26 +0200 Subject: [PATCH] nmcli: move an assignment down to where the value needed It's happier there. No change in behavior. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1317 --- src/nmcli/common.c | 4 ++-- 1 file 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);