diff options
author | Thomas Haller <thaller@redhat.com> | 2015-05-18 15:11:00 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-05-18 15:20:22 +0200 |
commit | eb2efaa2282b452a1ce74efd8338cfbadd7bde9e (patch) | |
tree | 8b67726f68e7f6c548400b372ef29d3c6ce70daa | |
parent | 9a49fa7fb1640698d32fab923c2934ae5ce72ae3 (diff) | |
download | NetworkManager-eb2efaa2282b452a1ce74efd8338cfbadd7bde9e.tar.gz |
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
-rw-r--r-- | src/devices/nm-device-factory.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); } |