gtkprintbackendfile: Check the GtkPrintSettings passed to file_printer_get_options is not NULL before using it

https://bugzilla.gnome.org/show_bug.cgi?id=703784
This commit is contained in:
Carlos Garcia Campos 2013-11-08 15:42:15 +01:00 committed by Matthias Clasen
parent dd6f4fb785
commit 6130f076be

View File

@ -219,7 +219,7 @@ output_file_from_settings (GtkPrintSettings *settings,
if (uri == NULL)
{
const gchar *extension, *basename, *output_dir;
const gchar *extension, *basename = NULL, *output_dir = NULL;
gchar *name, *locale_name, *path;
if (default_format)
@ -244,7 +244,8 @@ output_file_from_settings (GtkPrintSettings *settings,
}
}
basename = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME);
if (settings)
basename = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_BASENAME);
if (basename == NULL)
basename = _("output");
@ -254,8 +255,9 @@ output_file_from_settings (GtkPrintSettings *settings,
g_free (name);
if (locale_name != NULL)
{
output_dir = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_DIR);
{
if (settings)
output_dir = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_DIR);
if (output_dir == NULL)
{
const gchar *document_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);