From bc9cad512451d3f5d63c1892668d1c7aec370227 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 20 Mar 2023 21:42:11 +0000 Subject: [PATCH] clutter: Safely transform paths to strings and vice versa GValues containing objects and strings can be set to NULL, which means the transformation functions from ClutterPath to string and vice versa must be NULL-safe. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2625 Part-of: --- clutter/clutter/clutter-path.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/clutter/clutter/clutter-path.c b/clutter/clutter/clutter-path.c index 9c0155de8..6d0fc0110 100644 --- a/clutter/clutter/clutter-path.c +++ b/clutter/clutter/clutter-path.c @@ -211,19 +211,26 @@ static void clutter_value_transform_path_string (const GValue *src, GValue *dest) { - gchar *string = clutter_path_get_description (src->data[0].v_pointer); + if (src->data[0].v_pointer != NULL) + { + gchar *string = clutter_path_get_description (src->data[0].v_pointer); - g_value_take_string (dest, string); + g_value_take_string (dest, string); + } } static void clutter_value_transform_string_path (const GValue *src, GValue *dest) { - ClutterPath *new_path; + const char *str; - new_path = clutter_path_new_with_description (g_value_get_string (src)); - g_value_take_object (dest, new_path); + str = g_value_get_string (src); + if (str != NULL) + { + ClutterPath *new_path = clutter_path_new_with_description (str); + g_value_take_object (dest, new_path); + } } static void