[gtk+] Ensure that the path is always set



commit 51db8f8f538cc14a255d55c7d61c3a0844e52447
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Dec 5 11:07:46 2017 +0000

    Ensure that the path is always set
    
    We are using `path` unconditionally, but it can be conditionally filled.
    To avoid inconsistent internal state, and a compiler warning, let's
    assert that the variable is always set.

 gdk/gdkcontentserializer.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkcontentserializer.c b/gdk/gdkcontentserializer.c
index e033272..1a6add9 100644
--- a/gdk/gdkcontentserializer.c
+++ b/gdk/gdkcontentserializer.c
@@ -615,7 +615,7 @@ static void
 file_text_serializer (GdkContentSerializer *serializer)
 {
   const GValue *value;
-  char *path;
+  char *path = NULL;
 
   value = gdk_content_serializer_get_value (serializer);
 
@@ -651,6 +651,8 @@ file_text_serializer (GdkContentSerializer *serializer)
       path = g_string_free (str, FALSE);
     }
 
+  g_assert (path != NULL);
+
   g_output_stream_write_all_async (gdk_content_serializer_get_output_stream (serializer),
                                    path,
                                    strlen (path),


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