From d16776b5fd97ba9a387e282da985e78ba261130a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 8 Sep 2020 18:25:02 +0200 Subject: [PATCH] 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. --- src/nm-l3-config-data.c | 2 ++ 1 file changed, 2 insertions(+) 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);