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)) 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); g_free (fullname);
return NULL; 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 */ /* Determine the full pathname of the ui file */
ui_fullname = gnc_filepath_locate_ui_file (ui_filename); ui_fullname = gnc_filepath_locate_ui_file (ui_filename);
g_return_val_if_fail (ui_fullname != NULL, NULL);
priv->parent_window = enclosing_win; priv->parent_window = enclosing_win;

View File

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