mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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
This commit is contained in:
parent
c9bef42eda
commit
0dccf4e0cb
@ -49,6 +49,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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."));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user