From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:05 +0000 (-0700) Subject: Return default value in case of NULL key instead of ASSERTing. X-Git-Tag: stable-10.2.0~522 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df26946e952539a2f90fcf983dbd0a4f7d3304ee;p=thirdparty%2Fopen-vm-tools.git Return default value in case of NULL key instead of ASSERTing. The configKey is NULL for NullProvider, so VMTools_ConfigGetBoolean should return default value if any of the input args is NULL. --- diff --git a/open-vm-tools/libvmtools/vmtoolsConfig.c b/open-vm-tools/libvmtools/vmtoolsConfig.c index 8f422f938..3f3e9ca1d 100644 --- a/open-vm-tools/libvmtools/vmtoolsConfig.c +++ b/open-vm-tools/libvmtools/vmtoolsConfig.c @@ -547,9 +547,12 @@ VMTools_ConfigGetBoolean(GKeyFile *config, GError *err = NULL; gboolean value; - ASSERT(config); - ASSERT(key); - ASSERT(section); + if (config == NULL || section == NULL || key == NULL) { + g_debug("%s: Returning default value for '[%s] %s'=%s.\n", + __FUNCTION__, section ? section : "(null)", + key ? key : "(null)", defValue ? "TRUE" : "FALSE"); + return defValue; + } value = g_key_file_get_boolean(config, section, key, &err); if (err != NULL) {