From 7faeda83517341121b60ade2362767d62104c420 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 30 Oct 2021 09:44:32 +0200 Subject: [PATCH] platform: accept %NULL route as parameter to nm_platform_ip_route_get_gateway() It's sometimes convenient to accept %NULL and have a "maybe type" like behavior to propagate the %NULL input of the getter. --- src/libnm-platform/nm-platform.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index d3d8ae3070..4667125f24 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -2176,7 +2176,9 @@ static inline gconstpointer nm_platform_ip_route_get_gateway(int addr_family, const NMPlatformIPRoute *route) { nm_assert_addr_family(addr_family); - nm_assert(route); + + if (!route) + return NULL; if (NM_IS_IPv4(addr_family)) return &((NMPlatformIP4Route *) route)->gateway;