[glib/key-file-no-file] key file: Handle filename being NULL



commit 953f23f13ced4002834f7622b21da1703a323047
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jul 10 11:14:03 2019 -0400

    key file: Handle filename being NULL
    
    This happens when we are default-constructed
    without explicit arguments.
    
    Closes: https://gitlab.gnome.org/GNOME/glib/issues/1825

 gio/gkeyfilesettingsbackend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
index 3bc392351..b33a4ad69 100644
--- a/gio/gkeyfilesettingsbackend.c
+++ b/gio/gkeyfilesettingsbackend.c
@@ -740,7 +740,8 @@ g_keyfile_settings_backend_set_property (GObject      *object,
     case PROP_FILENAME:
       /* Construct only. */
       g_assert (kfsb->file == NULL);
-      kfsb->file = g_file_new_for_path (g_value_get_string (value));
+      if (g_value_get_string (value))
+        kfsb->file = g_file_new_for_path (g_value_get_string (value));
       break;
 
     case PROP_ROOT_PATH:


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