diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index 991fed62a8..7a4e219cec 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -446,11 +446,16 @@ nm_connection_compare (NMConnection *a, GHashTableIter iter; NMSetting *src; - if (!a && !b) + if (a == b) return TRUE; if (!a || !b) return FALSE; + /* B / A: ensure settings in B that are not in A make the comparison fail */ + if (g_hash_table_size (NM_CONNECTION_GET_PRIVATE (a)->settings) != + g_hash_table_size (NM_CONNECTION_GET_PRIVATE (b)->settings)) + return FALSE; + /* A / B: ensure all settings in A match corresponding ones in B */ g_hash_table_iter_init (&iter, NM_CONNECTION_GET_PRIVATE (a)->settings); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &src)) { @@ -460,11 +465,6 @@ nm_connection_compare (NMConnection *a, return FALSE; } - /* B / A: ensure settings in B that are not in A make the comparison fail */ - if (g_hash_table_size (NM_CONNECTION_GET_PRIVATE (a)->settings) != - g_hash_table_size (NM_CONNECTION_GET_PRIVATE (b)->settings)) - return FALSE; - return TRUE; }