From 0dccf4e0cb88b11d1e951e417a97eb8a4044afaa Mon Sep 17 00:00:00 2001 From: Chris Shoemaker Date: Sun, 12 Feb 2006 02:40:35 +0000 Subject: [PATCH] Gracefully handle errors in report options. This prevents the whole program from crashing when unrecognized report options are used. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13227 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/report-gnome/gnc-plugin-page-report.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index cf99eb388b..e3c8c6d523 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -49,6 +49,7 @@ #include #include +#include "gfec.h" #include "gnc-component-manager.h" #include "gnc-engine.h" #include "gnc-gconf-utils.h" @@ -1286,17 +1287,25 @@ gnc_plugin_page_report_export_cb( GtkAction *action, GncPluginPageReport *report return; } +static void +error_handler(const char *str) +{ + g_warning("Report Error: %s", str); +} + static void gnc_plugin_page_report_options_cb( GtkAction *action, GncPluginPageReport *report ) { GncPluginPageReportPrivate *priv; SCM start_editor = scm_c_eval_string("gnc:report-edit-options"); + SCM result; priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report); if (priv->cur_report == SCM_BOOL_F) return; - if (scm_call_1(start_editor, priv->cur_report) == SCM_BOOL_F) { + result = gfec_apply(start_editor, priv->cur_report, error_handler); + if (result == SCM_BOOL_F || result == SCM_UNDEFINED) { gnc_warning_dialog(GTK_WIDGET(gnc_ui_get_toplevel()), _("There are no options for this report.")); }