From 79913fb446f2f66bfd898acf90e9b3afa5a4b54a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 16 Sep 2020 12:40:31 +0200 Subject: [PATCH] l3cfg: allow %NULL argument for nm_l3_config_data_ref() It's often convenient not to require the caller to check for %NULL. On the other hand, there are cases where having a %NULL instance is a bug, so gracefully accepting %NULL might hide bugs. Still, change it. --- src/nm-l3-config-data.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nm-l3-config-data.c b/src/nm-l3-config-data.c index c13fdbc249..a5080b0bb8 100644 --- a/src/nm-l3-config-data.c +++ b/src/nm-l3-config-data.c @@ -434,8 +434,10 @@ nm_l3_config_data_new (NMDedupMultiIndex *multi_idx, const NML3ConfigData * nm_l3_config_data_ref (const NML3ConfigData *self) { - nm_assert (_NM_IS_L3_CONFIG_DATA (self, TRUE)); - ((NML3ConfigData *) self)->ref_count++; + if (self) { + nm_assert (_NM_IS_L3_CONFIG_DATA (self, TRUE)); + ((NML3ConfigData *) self)->ref_count++; + } return self; }