]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Return default value in case of NULL key instead of ASSERTing.
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:05 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:05 +0000 (11:23 -0700)
The configKey is NULL for NullProvider, so VMTools_ConfigGetBoolean
should return default value if any of the input args is NULL.

open-vm-tools/libvmtools/vmtoolsConfig.c

index 8f422f938c8a6cfdacecc17421585f9507a8b326..3f3e9ca1d30c529fcc88d32ce5d3112c29b35026 100644 (file)
@@ -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) {