Bug 708526 - GnuCash Crashes when opening About page

Downgrade the g_error in gnc_filepath_locate_file() to a g_warning
and ensure that all users will properly handle a NULL return value.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23477 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2013-12-02 23:46:40 +00:00
parent c914f15eac
commit 219c780641
3 changed files with 12 additions and 10 deletions

View File

@ -555,7 +555,7 @@ gnc_filepath_locate_file (const gchar *default_path, const gchar *name)
if (!g_file_test (fullname, G_FILE_TEST_IS_REGULAR))
{
g_error ("Could not locate file %s", name);
g_warning ("Could not locate file %s", name);
g_free (fullname);
return NULL;
}

View File

@ -366,6 +366,7 @@ gnc_embedded_window_new (const gchar *action_group_name,
/* Determine the full pathname of the ui file */
ui_fullname = gnc_filepath_locate_ui_file (ui_filename);
g_return_val_if_fail (ui_fullname != NULL, NULL);
priv->parent_window = enclosing_win;

View File

@ -4300,18 +4300,19 @@ static gchar *
get_file (const gchar *partial)
{
gchar *filename, *text = NULL;
gsize length;
filename = gnc_filepath_locate_doc_file(partial);
g_file_get_contents(filename, &text, NULL, NULL);
g_free(filename);
/* Anything there? */
if (text && *text)
return text;
/* Just a empty string or no string at all. */
if (text)
if (filename && g_file_get_contents(filename, &text, &length, NULL))
{
if (length)
{
g_free(filename);
return text;
}
g_free(text);
}
g_free (filename);
return NULL;
}