diff options
author | Thomas Haller <thaller@redhat.com> | 2020-09-08 18:25:02 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-09-11 16:18:35 +0200 |
commit | d16776b5fd97ba9a387e282da985e78ba261130a (patch) | |
tree | 8930951099c480dbc1ddd4422ff7bf1ed61c3281 | |
parent | 6358d10688289ef78693a763c194587c5ac2af43 (diff) | |
download | NetworkManager-d16776b5fd97ba9a387e282da985e78ba261130a.tar.gz |
l3cfg: gracefully accept %NULL argument in nm_l3_config_data_lookup_objs()
This way we can safely iterate over a %NULL instance with
nm_l3_config_data_iter_obj_for_each(). This avoids a NULL check,
which in this case seems more annoying than helpful.
-rw-r--r-- | src/nm-l3-config-data.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nm-l3-config-data.c b/src/nm-l3-config-data.c index a060dc78f0..bff22c578f 100644 --- a/src/nm-l3-config-data.c +++ b/src/nm-l3-config-data.c @@ -583,6 +583,8 @@ nm_l3_config_data_lookup_index (const NML3ConfigData *self, NMPObjectType obj_ty const NMDedupMultiHeadEntry * nm_l3_config_data_lookup_objs (const NML3ConfigData *self, NMPObjectType obj_type) { + if (!self) + return NULL; return nm_dedup_multi_index_lookup_head (self->multi_idx, nm_l3_config_data_lookup_index (self, obj_type), NULL); |