From 882168c72862b07a2ffb9cbf83ddd7b90f1d29a0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 16 Sep 2021 16:22:19 +0200 Subject: [PATCH] l3cfg: accept %NULL argument to nm_l3_config_data_seal() There is always a question between convenience of allowing %NULL (and do nothing) and strictly require the user to check the argument to not be %NULL. In this case, it's more convenient to accept NULL, than require the callers to check for it. --- src/core/nm-l3-config-data.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/nm-l3-config-data.c b/src/core/nm-l3-config-data.c index d41d95ecab..cb0f608795 100644 --- a/src/core/nm-l3-config-data.c +++ b/src/core/nm-l3-config-data.c @@ -700,8 +700,10 @@ nm_l3_config_data_ref_and_seal(const NML3ConfigData *self) const NML3ConfigData * nm_l3_config_data_seal(const NML3ConfigData *self) { - nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE)); - ((NML3ConfigData *) self)->is_sealed = TRUE; + if (self) { + nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE)); + ((NML3ConfigData *) self)->is_sealed = TRUE; + } return self; }