Check whether session has been created before trying to end it.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20229 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2011-02-04 01:54:30 +00:00
parent 947b60f511
commit 3fe1707d22

View File

@ -227,7 +227,7 @@ test_dbi_store_and_reload( const gchar* driver, QofSession* session_1, const gch
void
test_dbi_safe_save( const gchar* driver, const gchar* url )
{
QofSession *session_1, *session_2;
QofSession *session_1 = NULL, *session_2 = NULL;
printf( "Testing safe save %s\n", driver );
@ -266,10 +266,16 @@ test_dbi_safe_save( const gchar* driver, const gchar* url )
qof_session_get_book( session_2 ) );
cleanup:
qof_session_end( session_2 );
qof_session_destroy( session_2 );
qof_session_end( session_1 );
qof_session_destroy( session_1 );
if (session_2 != NULL)
{
qof_session_end( session_2 );
qof_session_destroy( session_2 );
}
if (session_1 != NULL)
{
qof_session_end( session_1 );
qof_session_destroy( session_1 );
}
return;
}