1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Null checks on SqliteSampleBlock::mpFactory

This commit is contained in:
Paul Licameli
2020-10-07 15:33:13 -04:00
parent cce2c7b883
commit 4ca09d55a1
2 changed files with 9 additions and 4 deletions

View File

@@ -300,9 +300,11 @@ SqliteSampleBlock::SqliteSampleBlock(
SqliteSampleBlock::~SqliteSampleBlock()
{
auto &callback = mpFactory->mCallback;
if (callback)
GuardedCall( [&]{ callback( *this ); } );
if (mpFactory) {
auto &callback = mpFactory->mCallback;
if (callback)
GuardedCall( [&]{ callback( *this ); } );
}
if (IsSilent()) {
// The block object was constructed but failed to Load() or Commit().
@@ -330,6 +332,9 @@ SqliteSampleBlock::~SqliteSampleBlock()
DBConnection *SqliteSampleBlock::Conn() const
{
if (!mpFactory)
return nullptr;
auto &pConnection = mpFactory->mppConnection->mpConnection;
if (!pConnection) {
throw SimpleMessageBoxException