From 6130f076be70ba51404fab4b3bf724bbf6bcb87c Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Fri, 8 Nov 2013 15:42:15 +0100 Subject: [PATCH] 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 --- modules/printbackends/file/gtkprintbackendfile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/printbackends/file/gtkprintbackendfile.c b/modules/printbackends/file/gtkprintbackendfile.c index 9fe2d78b30..ff850f1c2a 100644 --- a/modules/printbackends/file/gtkprintbackendfile.c +++ b/modules/printbackends/file/gtkprintbackendfile.c @@ -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);