Do not %s-printf NULL-title of average balance plot. Fix #397935.

The average balance report does not specify a title for the plot, so we
must not printf it or GnuCash will crash on Windows.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15420 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2007-01-23 02:50:40 +00:00
parent 1ca2c7f405
commit b45ce825eb

View File

@ -231,23 +231,22 @@ set_chart_titles_from_hash(GogObject *chart, GtkHTMLEmbedded * eb)
static void
set_chart_titles(GogObject *chart, const char *title, const char* sub_title)
{
GString *totalTitle;
GOData *titleScalar;
gchar *my_sub_title, *total_title;
GOData *title_scalar;
GogObject *tmp;
totalTitle = g_string_sized_new(32);
g_string_printf(totalTitle, "%s", title);
if (sub_title != NULL)
{
g_string_append_printf(totalTitle, " (%s)", sub_title);
}
if (sub_title)
my_sub_title = g_strdup_printf("%s(%s)", title ? " " : "", sub_title);
else
my_sub_title = g_strdup("");
total_title = g_strdup_printf("%s%s", title ? title : "", my_sub_title);
tmp = gog_object_add_by_name(chart, "Title", NULL);
titleScalar = go_data_scalar_str_new(totalTitle->str, FALSE);
gog_dataset_set_dim(GOG_DATASET(tmp), 0, titleScalar, NULL);
title_scalar = go_data_scalar_str_new(total_title, TRUE);
gog_dataset_set_dim(GOG_DATASET(tmp), 0, title_scalar, NULL);
// @@fixme -- record or ref the string for freeing...
g_string_free(totalTitle, FALSE);
g_free(my_sub_title);
}
static void