gnucash master: Bug 789730 Bis: Sometimes we get lists of Account*
John Ralls
jralls at code.gnucash.org
Sat Jan 21 18:59:40 EST 2023
Updated via https://github.com/Gnucash/gnucash/commit/09751e20 (commit)
from https://github.com/Gnucash/gnucash/commit/d981679c (commit)
commit 09751e20c554b684bd2a2e07bf5f964e21f41bc5
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Jan 21 15:57:39 2023 -0800
Bug 789730 Bis: Sometimes we get lists of Account*
And sometimes a list of Guid strings. Handle either.
diff --git a/bindings/guile/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i
index 610b1a38b..97b693bdc 100644
--- a/bindings/guile/gnc-optiondb.i
+++ b/bindings/guile/gnc-optiondb.i
@@ -472,10 +472,26 @@ scm_to_value<GncOptionAccountList>(SCM new_value)
auto next{new_value};
while (!scm_is_null(next) && scm_car(next))
{
- auto guid_str{scm_to_utf8_string(scm_car(next))};
- GncGUID guid;
- string_to_guid(guid_str, &guid);
- retval.push_back(guid);
+/* If the incoming scheme is from a report then it will contain an Account*, if
+ * it's from restoring a saved report config it will be a guid.
+ */
+ if (scm_is_string(scm_car(next)))
+ {
+ auto guid_str{scm_to_utf8_string(scm_car(next))};
+ GncGUID guid;
+ string_to_guid(guid_str, &guid);
+ retval.push_back(guid);
+ }
+ else
+ {
+ void *account{};
+ SWIG_ConvertPtr(scm_car(next), &account, SWIGTYPE_p_Account, 0);
+ if (account)
+ {
+ auto guid{qof_entity_get_guid(static_cast<Account *>(account))};
+ retval.push_back(*guid);
+ }
+ }
next = scm_cdr(next);
}
return retval;
Summary of changes:
bindings/guile/gnc-optiondb.i | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
More information about the gnucash-changes
mailing list