From 09751e20c554b684bd2a2e07bf5f964e21f41bc5 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 21 Jan 2023 15:57:39 -0800 Subject: [PATCH] Bug 789730 Bis: Sometimes we get lists of Account* And sometimes a list of Guid strings. Handle either. --- bindings/guile/gnc-optiondb.i | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/bindings/guile/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i index 610b1a38bd..97b693bdc1 100644 --- a/bindings/guile/gnc-optiondb.i +++ b/bindings/guile/gnc-optiondb.i @@ -472,10 +472,26 @@ scm_to_value(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))}; + retval.push_back(*guid); + } + } next = scm_cdr(next); } return retval;