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: 71bde20c30
This commit is contained in:
Thomas Haller 2015-05-18 15:11:00 +02:00
parent 9a49fa7fb1
commit eb2efaa228

View file

@ -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);
}