1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 15:23:48 +01:00

another null check on GetActiveProject

This commit is contained in:
Paul Licameli
2020-01-03 20:27:07 -05:00
parent 4385326e9d
commit a178f0df09

View File

@@ -40,15 +40,17 @@ void CommandHandler::OnReceiveCommand(AppCommandEvent &event)
// First retrieve the actual command from the event 'envelope'.
OldStyleCommandPointer cmd = event.GetCommand();
// Then apply it to current application & project. Note that the
// command may change the context - for example, switching to a
// different project.
CommandContext context{ *GetActiveProject() };
auto result = GuardedCall<bool>( [&] {
return cmd->Apply( context );
});
wxUnusedVar(result);
if (const auto pProject = GetActiveProject()) {
// Then apply it to current application & project. Note that the
// command may change the context - for example, switching to a
// different project.
CommandContext context{ *pProject };
auto result = GuardedCall<bool>( [&] {
return cmd->Apply( context );
});
wxUnusedVar(result);
// Redraw the project
ProjectWindow::Get( context.project ).RedrawProject();
// Redraw the project
ProjectWindow::Get( context.project ).RedrawProject();
}
}