[glib/keyfile-filename-assertion] gkeyfilesettingsbackend: do not assume filename is non-NULL



commit fc0431a532ecbbcdcd072b84a72ece7fe7849b44
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Jul 10 18:14:34 2019 +0300

    gkeyfilesettingsbackend: do not assume filename is non-NULL
    
    Fixes #1825

 gio/gkeyfilesettingsbackend.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
index 3bc392351..d98547476 100644
--- a/gio/gkeyfilesettingsbackend.c
+++ b/gio/gkeyfilesettingsbackend.c
@@ -734,13 +734,16 @@ g_keyfile_settings_backend_set_property (GObject      *object,
                                          GParamSpec   *pspec)
 {
   GKeyfileSettingsBackend *kfsb = G_KEYFILE_SETTINGS_BACKEND (object);
+  const gchar *filename;
 
   switch ((GKeyfileSettingsBackendProperty)prop_id)
     {
     case PROP_FILENAME:
       /* Construct only. */
       g_assert (kfsb->file == NULL);
-      kfsb->file = g_file_new_for_path (g_value_get_string (value));
+      filename = g_value_get_string (value);
+      if (filename)
+          kfsb->file = g_file_new_for_path (filename);
       break;
 
     case PROP_ROOT_PATH:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]