From aa7c2a55d69ce56704cf73457198b49b0c39f7f3 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 8 Apr 2026 15:46:23 +0200 Subject: [PATCH] Issue #16169: do not serialize empty string value. Reverting a part of commit fa097df9 which should not have been merged, and in fact which was not useful anymore for fixing the original issue. This fixes part of #16169, which is that because of this change, we were creating broken XCF containing both a text and a markup variant for text-only text layers. Typically it was storing: > (text "I love GIMP") > (markup "") Now we don't create such broken XCF anymore, but I'll want to strengthen reading code too, so that we can salvage such XCF files, already existing in the wild. --- libgimpconfig/gimpconfig-serialize.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libgimpconfig/gimpconfig-serialize.c b/libgimpconfig/gimpconfig-serialize.c index c9f19eb258..7960b35cbe 100644 --- a/libgimpconfig/gimpconfig-serialize.c +++ b/libgimpconfig/gimpconfig-serialize.c @@ -576,10 +576,13 @@ gimp_config_serialize_value (const GValue *value, { const gchar *cstr = g_value_get_string (value); + if (! cstr) + return FALSE; + if (escaped) - gimp_config_string_append_escaped (str, cstr ? cstr : ""); + gimp_config_string_append_escaped (str, cstr); else - g_string_append (str, cstr ? cstr : ""); + g_string_append (str, cstr); return TRUE; }