From 54ffc982e96bc4b2484a2611c7dc5cf24c4c4a1a Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 1 Mar 2013 10:13:20 -0800 Subject: [PATCH] Fix gtkprintbackendcups crash From trying to call g_list_delete_link with a NULL node or removed_printer_checklist. --- modules/printbackends/cups/gtkprintbackendcups.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 96f4be4103..8dbc78bf89 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -2067,11 +2067,15 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend, } /* remove name from checklist if it was found */ - node = g_list_find_custom (removed_printer_checklist, - info->printer_name, - (GCompareFunc) find_printer); - removed_printer_checklist = g_list_delete_link (removed_printer_checklist, - node); + if (removed_printer_checklist != NULL) + { + if (node = g_list_find_custom (removed_printer_checklist, + info->printer_name, + (GCompareFunc) find_printer)) + removed_printer_checklist = + g_list_delete_link (removed_printer_checklist, + node); + } printer = gtk_print_backend_find_printer (backend, info->printer_name); if (!printer)