summary refs log tree commit diff
path: root/libnm-core/nm-setting-wireguard.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-core/nm-setting-wireguard.c')
-rw-r--r--libnm-core/nm-setting-wireguard.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libnm-core/nm-setting-wireguard.c b/libnm-core/nm-setting-wireguard.c
index 2bd633ce..3b2815c0 100644
--- a/libnm-core/nm-setting-wireguard.c
+++ b/libnm-core/nm-setting-wireguard.c
@@ -592,13 +592,16 @@ nm_wireguard_peer_get_allowed_ip (const NMWireGuardPeer *self,
 {
 	const char *s;
 
+	/* With LTO, the compiler might warn about the g_return_val_if_fail()
+	 * code path not initializing the output argument. Workaround that by
+	 * always setting the out argument. */
+	NM_SET_OUT (out_is_valid, FALSE);
+
 	g_return_val_if_fail (NM_IS_WIREGUARD_PEER (self, TRUE), NULL);
 
 	if (   !self->allowed_ips
-	    || idx >= self->allowed_ips->len) {
-		NM_SET_OUT (out_is_valid, FALSE);
+	    || idx >= self->allowed_ips->len)
 		return NULL;
-	}
 
 	s = self->allowed_ips->pdata[idx];
 	NM_SET_OUT (out_is_valid, s[0] != ALLOWED_IP_INVALID_X);