Bug 789730 Bis: Sometimes we get lists of Account*

And sometimes a list of Guid strings. Handle either.
This commit is contained in:
John Ralls 2023-01-21 15:57:39 -08:00
parent d981679cbe
commit 09751e20c5

View File

@ -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;