r18899 - gnucash/trunk/src/report/report-gnome - Fix Bug 611346 - Crash in Saved Reports dialog if you select Delete button with no report selected

Phil Longstaff plongstaff at code.gnucash.org
Sat Mar 13 07:02:02 EST 2010


Author: plongstaff
Date: 2010-03-13 07:02:02 -0500 (Sat, 13 Mar 2010)
New Revision: 18899
Trac: http://svn.gnucash.org/trac/changeset/18899

Modified:
   gnucash/trunk/src/report/report-gnome/dialog-custom-report.c
Log:
Fix Bug 611346 - Crash in Saved Reports dialog if you select Delete button with no report selected

Test for no report selected before trying to use the selected report guid.


Modified: gnucash/trunk/src/report/report-gnome/dialog-custom-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/dialog-custom-report.c	2010-03-12 22:43:47 UTC (rev 18898)
+++ gnucash/trunk/src/report/report-gnome/dialog-custom-report.c	2010-03-13 12:02:02 UTC (rev 18899)
@@ -302,18 +302,19 @@
     sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(crd->reportview));
 
     guid = get_custom_report_selection(crd, _("You must select a report to delete."));
-    report_name = scm_to_locale_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
+    if (!scm_is_null(guid))
+    {
+        report_name = scm_to_locale_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
 
-    /* we must confirm the user wants to delete their precious custom report! */
-    if (!scm_is_null(guid)
-            && gnc_verify_dialog(crd->dialog, FALSE, "Are you sure you want to delete %s?", report_name))
-    {
-        SCM del_report = scm_c_eval_string("gnc:delete-report");
-        scm_call_1(del_report, guid);
-        update_report_list(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(crd->reportview)))
-                           , crd);
+        /* we must confirm the user wants to delete their precious custom report! */
+        if (gnc_verify_dialog(crd->dialog, FALSE, "Are you sure you want to delete %s?", report_name))
+        {
+            SCM del_report = scm_c_eval_string("gnc:delete-report");
+            scm_call_1(del_report, guid);
+            update_report_list(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(crd->reportview))),
+                               crd);
+        }
     }
-
 }
 
 static void



More information about the gnucash-changes mailing list