[gnucash-commands.cpp] fix guile error handling

* id is an SCM object which is never NULL, but may be #f to signal error.
This commit is contained in:
Christopher Lam 2020-08-09 13:27:59 +08:00
parent be96f3bf68
commit 9d28edb332

View File

@ -215,13 +215,16 @@ scm_run_report (void *data,
if (!args->export_type.empty()) if (!args->export_type.empty())
{ {
scm_call_3(run_export_cmd, report, type, file); SCM retval = scm_call_3(run_export_cmd, report, type, file);
if (scm_is_false (retval))
scm_cleanup_and_exit_with_failure (nullptr);
} }
else else
{ {
SCM id = scm_call_1(get_report_cmd, report); SCM id = scm_call_1(get_report_cmd, report);
if (!id) if (scm_is_false (id))
scm_cleanup_and_exit_with_failure (nullptr); scm_cleanup_and_exit_with_failure (nullptr);
char* html; char* html;
gnc_run_report (scm_to_int(id), &html); gnc_run_report (scm_to_int(id), &html);