From eb2efaa2282b452a1ce74efd8338cfbadd7bde9e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 18 May 2015 15:11:00 +0200 Subject: [PATCH] device: fix wrong assert in NMDeviceFactory nm_device_factory_manager_find_factory_for_link_type() easily can see a link-type NM_LINK_TYPE_UNKNOWN because there are many link types that NetworkManager cannot detect. Just return NULL early. Fixes: 71bde20c302ba321688f203a8c5cd1e2d296f0d1 --- src/devices/nm-device-factory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c index de7e9d7312..1303480857 100644 --- a/src/devices/nm-device-factory.c +++ b/src/devices/nm-device-factory.c @@ -302,7 +302,9 @@ nm_device_factory_manager_find_factory_for_link_type (NMLinkType link_type) { const NMLinkType ltypes[2] = { link_type, NM_LINK_TYPE_NONE }; - g_assert (ltypes[0] > NM_LINK_TYPE_UNKNOWN); + if (link_type == NM_LINK_TYPE_UNKNOWN) + return NULL; + g_return_val_if_fail (link_type > NM_LINK_TYPE_UNKNOWN, NULL); return find_factory (ltypes, NULL); }