network: do not trigger assertion when link_get_by_index() called with an invalid ifindex

Should not change any behavior. Preparation for later commit.
This commit is contained in:
Yu Watanabe
2023-12-12 01:27:09 +09:00
parent 3d11b46bf7
commit c2aed12836

View File

@@ -252,7 +252,9 @@ int link_get_by_index(Manager *m, int ifindex, Link **ret) {
Link *link;
assert(m);
assert(ifindex > 0);
if (ifindex <= 0)
return -EINVAL;
link = hashmap_get(m->links_by_index, INT_TO_PTR(ifindex));
if (!link)