From 9aa7ad31d24f64bff63f98d876e0142a6b32ae2b Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Mon, 11 Dec 2006 22:28:36 +0000 Subject: [PATCH] Check for potentially failed utf8 conversion of locale strings. bug#383270 BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15204 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/app-utils/gnc-ui-util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c index 8744cd066d..3b70ff2760 100644 --- a/src/app-utils/gnc-ui-util.c +++ b/src/app-utils/gnc-ui-util.c @@ -734,6 +734,11 @@ gnc_lconv_set_utf8 (char **p_value, char *default_value) *p_value = default_value; *p_value = g_locale_to_utf8 (*p_value, -1, NULL, NULL, NULL); + if (*p_value == NULL) { + // The g_locale_to_utf8 conversion failed. FIXME: Should we rather + // use an empty string instead of the default_value? Not sure. + *p_value = default_value; + } // FIXME: Do we really need to make a copy here ? //*p_value = g_strdup (*p_value); }