Fix crash if gnucash-cli --quotes is passed a bad database name.

cleanup_and_exit_with_failure doesn't exit anymore so we need
to return its error value instead of trying to keep using the
freed session.
This commit is contained in:
John Ralls 2023-04-04 16:46:00 -07:00
parent efb24f090d
commit bc1f5b80c1

View File

@ -342,11 +342,11 @@ Gnucash::add_quotes (const bo_str& uri)
qof_session_begin(session, uri->c_str(), SESSION_NORMAL_OPEN);
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
cleanup_and_exit_with_failure (session);
return cleanup_and_exit_with_failure (session);
qof_session_load(session, NULL);
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
cleanup_and_exit_with_failure (session);
return cleanup_and_exit_with_failure (session);
try
{
@ -365,7 +365,7 @@ Gnucash::add_quotes (const bo_str& uri)
}
qof_session_save(session, NULL);
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
cleanup_and_exit_with_failure (session);
return cleanup_and_exit_with_failure (session);
qof_session_destroy(session);
qof_event_resume();