1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-03 17:39:25 +02: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

@ -325,7 +325,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
#endif
auto umodule = std::make_unique<Module>(files[i]);
if (umodule->Load()) // it will get rejected if there are version problems
if (umodule->Load()) // it will get rejected if there are version problems
{
auto module = umodule.get();

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