[gnome-control-center] printers: Check if printer name is NULL



commit d5110977da06d9ded500ef0b9362d5ac9ad0d64c
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Sun Jun 4 20:26:16 2017 +0530

    printers: Check if printer name is NULL
    
    This was causing a segfault when the user clicks the cancel button
    on add new printer dialog (in case when no printers are listed, and no
    printers are added).
    
    output from sanitizer:
    
    ==22669==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe1c7a4d409 bp 
0x7ffd179f6410 sp 0x7ffd179f6410 T0)
        #0 0x7fe1c7a4d408 in g_str_hash /home/sadiq/jhbuild/checkout/glib/glib/ghash.c:1882
        #1 0x7fe1c7a4c814 in g_hash_table_lookup_node /home/sadiq/jhbuild/checkout/glib/glib/ghash.c:379
        #2 0x7fe1c7a4c814 in g_hash_table_lookup /home/sadiq/jhbuild/checkout/glib/glib/ghash.c:1153
        #3 0x55cef023a121 in new_printer_dialog_response_cb 
/home/sadiq/jhbuild/checkout/gnome-control-center/panels/printers/cc-printers-panel.c:914
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783406

 panels/printers/cc-printers-panel.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 5694236..bee9714 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -915,6 +915,9 @@ new_printer_dialog_response_cb (PpNewPrinterDialog *dialog,
 
   actualize_printers_list (self);
 
+  if (priv->new_printer_name == NULL)
+    return;
+
   /* Scroll the view to show the newly added printer-entry. */
   scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (priv->builder,
                                                                  "scrolled-window"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]