diff --git a/src/core-utils/gnc-filepath-utils.c b/src/core-utils/gnc-filepath-utils.c index 545de6c75f..7e60493026 100644 --- a/src/core-utils/gnc-filepath-utils.c +++ b/src/core-utils/gnc-filepath-utils.c @@ -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; } diff --git a/src/gnome-utils/gnc-embedded-window.c b/src/gnome-utils/gnc-embedded-window.c index 75521c7f8b..c066e42b05 100644 --- a/src/gnome-utils/gnc-embedded-window.c +++ b/src/gnome-utils/gnc-embedded-window.c @@ -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; diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index bcbd1c03cc..3562f099cc 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -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; }